Class: Dotbox::Config
- Inherits:
-
Object
- Object
- Dotbox::Config
- Defined in:
- lib/dotbox/config.rb
Instance Method Summary collapse
-
#initialize(file, value = nil) ⇒ Config
constructor
A new instance of Config.
- #setted? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(file, value = nil) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 |
# File 'lib/dotbox/config.rb', line 4 def initialize(file, value = nil) @file = file if !value.nil? save(value) end end |
Instance Method Details
#setted? ⇒ Boolean
19 20 21 |
# File 'lib/dotbox/config.rb', line 19 def setted? ::File.exists?(@file) || !ENV['DROPBOX_PATH'].nil? end |
#value ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/dotbox/config.rb', line 11 def value if ENV['DROPBOX_PATH'].nil? ::File.new(@file).read.strip.chomp('/') else ENV['DROPBOX_PATH'] end end |