Module | Rascut::Utils |
In: |
lib/rascut/utils.rb
|
# File lib/rascut/utils.rb, line 25 25: def asdoc_home 26: path = home.join('asdoc') 27: path.mkpath 28: path 29: end
# 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
# File lib/rascut/utils.rb, line 50 50: def path_escape(name) 51: URI.encode(name.to_s.gsub('/', '_'), /[^\w_\-]/) 52: end
# 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