Class: Dotbox::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dotbox/config.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/dotbox/config.rb', line 19

def setted?
  ::File.exists?(@file) || !ENV['DROPBOX_PATH'].nil?
end

#valueObject



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