Class: Dropsite::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/dropsite/application.rb

Overview

Wraps the main configuration file. Exists mostly in case of future expansion of configuration options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ ConfigFile

Returns a new instance of ConfigFile.



80
81
82
# File 'lib/dropsite/application.rb', line 80

def initialize(path=nil)
  @path = path || dropsite_config_dir ? File.join(dropsite_config_dir, 'config.yml') : ''
end

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



78
79
80
# File 'lib/dropsite/application.rb', line 78

def exclude
  @exclude
end

#pathObject (readonly)

Returns the value of attribute path.



78
79
80
# File 'lib/dropsite/application.rb', line 78

def path
  @path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/dropsite/application.rb', line 91

def exist?
  File.exist? path
end

#readObject



84
85
86
87
88
89
# File 'lib/dropsite/application.rb', line 84

def read
  return if not exist?
  config = YAML::load(IO.read(path))
  @exclude = config['exclude']
  self
end