Class: Ruku::Storage
- Inherits:
-
Object
- Object
- Ruku::Storage
- Defined in:
- lib/ruku/storage.rb
Direct Known Subclasses
Constant Summary collapse
- FILE_NAME =
'.ruku-boxes'
Instance Attribute Summary collapse
-
#storage_path ⇒ Object
Returns the value of attribute storage_path.
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ Storage
constructor
A new instance of Storage.
Constructor Details
#initialize(path = nil) ⇒ Storage
Returns a new instance of Storage.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ruku/storage.rb', line 6 def initialize(path=nil) @storage_path = path if not @storage_path home = ENV['HOME'] home = ENV['USERPROFILE'] if not home if !home && (ENV['HOMEDRIVE'] && ENV['HOMEPATH']) home = File.join(ENV['HOMEDRIVE'], ENV['HOMEPATH']) end home = File.('~') if not home home = 'C:/' if !home && RUBY_PLATFORM =~ /mswin|mingw/ raise "Could not find user HOME directory" if not home @storage_path = File.join(home, FILE_NAME) end end |
Instance Attribute Details
#storage_path ⇒ Object
Returns the value of attribute storage_path.
4 5 6 |
# File 'lib/ruku/storage.rb', line 4 def storage_path @storage_path end |