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.
78 79 80 |
# File 'lib/dropsite/application.rb', line 78 def initialize(path=nil) @path = path || File.join(Dropsite.dropsite_config_dir, 'config.yml') end |
Instance Attribute Details
#exclude ⇒ Object (readonly)
Returns the value of attribute exclude.
76 77 78 |
# File 'lib/dropsite/application.rb', line 76 def exclude @exclude end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
76 77 78 |
# File 'lib/dropsite/application.rb', line 76 def path @path end |
Instance Method Details
#exist? ⇒ Boolean
89 90 91 |
# File 'lib/dropsite/application.rb', line 89 def exist? File.exist? path end |
#read ⇒ Object
82 83 84 85 86 87 |
# File 'lib/dropsite/application.rb', line 82 def read return if not exist? config = YAML::load(IO.read(path)) @exclude = config['exclude'] self end |