Class: Rordash::Chain
- Inherits:
-
Object
- Object
- Rordash::Chain
- Defined in:
- lib/rordash/chain.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #deep_compact ⇒ Object
-
#initialize(value) ⇒ Chain
constructor
A new instance of Chain.
- #merge(other) ⇒ Object
- #pick(paths) ⇒ Object
- #set(path, value) ⇒ Object
- #to_h ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(value) ⇒ Chain
5 6 7 |
# File 'lib/rordash/chain.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/rordash/chain.rb', line 3 def value @value end |
Instance Method Details
#deep_compact ⇒ Object
21 22 23 24 25 |
# File 'lib/rordash/chain.rb', line 21 def deep_compact @value = HashUtil.deep_compact(@value) self end |
#merge(other) ⇒ Object
32 33 34 35 |
# File 'lib/rordash/chain.rb', line 32 def merge(other) @value = @value.merge(other) self end |
#pick(paths) ⇒ Object
27 28 29 30 |
# File 'lib/rordash/chain.rb', line 27 def pick(paths) @value = HashUtil.pick(@value, paths) self end |
#set(path, value) ⇒ Object
37 38 39 40 |
# File 'lib/rordash/chain.rb', line 37 def set(path, value) HashUtil.set(@value, path, value) self end |
#to_h ⇒ Object
9 10 11 12 13 |
# File 'lib/rordash/chain.rb', line 9 def to_h @value = HashUtil.from_string(@value) self end |