Module Rascut::Utils
In: lib/rascut/utils.rb

Methods

Classes and Modules

Class Rascut::Utils::ProcHandler

Public Instance methods

[Source]

    # File lib/rascut/utils.rb, line 25
25:     def asdoc_home
26:       path = home.join('asdoc')
27:       path.mkpath
28:       path
29:     end

[Source]

    # File lib/rascut/utils.rb, line 9
 9:     def home
10:       if ENV['HOME']
11:         home = Pathname.new ENV['HOME']
12:       elsif ENV['USERPROFILE']
13:         # win32
14:         home = Pathname.new ENV['USERPROFILE']
15:       else
16:         raise 'HOME dir not found.'
17:       end
18: 
19:       home = home.join('.rascut')
20:       home.mkpath
21:       home
22:     end

[Source]

    # File lib/rascut/utils.rb, line 50
50:     def path_escape(name)
51:       URI.encode(name.to_s.gsub('/', '_'), /[^\w_\-]/)
52:     end

[Source]

    # File lib/rascut/utils.rb, line 37
37:     def rascut_db(readonly = false)
38:       db = PStore.new home.join('rascut.db').to_s
39:       db.transaction(readonly) do 
40:         yield db
41:       end
42:     end

[Source]

    # File lib/rascut/utils.rb, line 32
32:     def rascut_db_path
33:       home.join('rascut.db')
34:     end

[Source]

    # File lib/rascut/utils.rb, line 45
45:     def rascut_db_read(&block)
46:       rascut_db(true, &block)
47:     end

[Validate]