Class: Stic::Config
- Inherits:
-
Object
- Object
- Stic::Config
- Defined in:
- lib/stic/config.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #load(file) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
9 10 11 12 |
# File 'lib/stic/config.rb', line 9 def initialize( = {}) @options = @files = [] end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
6 7 8 |
# File 'lib/stic/config.rb', line 6 def files @files end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/stic/config.rb', line 6 def @options end |
Class Method Details
.load(file) ⇒ Object
21 22 23 |
# File 'lib/stic/config.rb', line 21 def load(file) new.tap{|c| c.load file } end |
Instance Method Details
#load(file) ⇒ Object
14 15 16 17 18 |
# File 'lib/stic/config.rb', line 14 def load(file) data = ::YAML.load(file.read) if file.exist? .deep_merge(data) if data.is_a?(Hash) files << file end |