Class: Flyml::Values
Instance Attribute Summary collapse
-
#file ⇒ Object
writeonly
Sets the attribute file.
Class Method Summary collapse
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object (also: #write)
-
#initialize(*args) ⇒ Values
constructor
A new instance of Values.
- #merge(*args) ⇒ Object
- #merge!(*args) ⇒ Object
- #recursive_symbolize_keys! ⇒ Object
Methods inherited from Hash
Constructor Details
#initialize(*args) ⇒ Values
Returns a new instance of Values.
13 14 15 16 |
# File 'lib/flyml/values.rb', line 13 def initialize(*args) @symbolize_on_write = true super end |
Instance Attribute Details
#file=(value) ⇒ Object (writeonly)
Sets the attribute file
5 6 7 |
# File 'lib/flyml/values.rb', line 5 def file=(value) @file = value end |
Class Method Details
.build(data, file = nil) ⇒ Object
7 8 9 10 11 |
# File 'lib/flyml/values.rb', line 7 def self.build(data, file=nil) setting_values = new.merge(data) setting_values.file = file setting_values end |
Instance Method Details
#[]=(key, value) ⇒ Object Also known as: write
37 38 39 40 41 |
# File 'lib/flyml/values.rb', line 37 def []=(key, value) super recursive_symbolize_keys! if @symbolize_on_write end |
#merge(*args) ⇒ Object
18 19 20 21 22 |
# File 'lib/flyml/values.rb', line 18 def merge(*args) obj = super obj.recursive_symbolize_keys! if @symbolize_on_write obj end |
#merge!(*args) ⇒ Object
24 25 26 27 28 |
# File 'lib/flyml/values.rb', line 24 def merge!(*args) obj = super obj.recursive_symbolize_keys! if @symbolize_on_write obj end |
#recursive_symbolize_keys! ⇒ Object
31 32 33 34 35 |
# File 'lib/flyml/values.rb', line 31 def recursive_symbolize_keys! @symbolize_on_write = false super @symbolize_on_write = true end |