Class: Dropsite::ConfigFile
- Inherits:
-
Object
- Object
- Dropsite::ConfigFile
- 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
-
#exclude ⇒ Object
readonly
Returns the value of attribute exclude.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(path = nil) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
- #read ⇒ Object
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
#exclude ⇒ Object (readonly)
Returns the value of attribute exclude.
78 79 80 |
# File 'lib/dropsite/application.rb', line 78 def exclude @exclude end |
#path ⇒ Object (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
91 92 93 |
# File 'lib/dropsite/application.rb', line 91 def exist? File.exist? path end |
#read ⇒ Object
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 |