Class: Hash::ValueChanger
- Inherits:
-
Object
- Object
- Hash::ValueChanger
- Defined in:
- lib/hash/value_changer.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #change(object) ⇒ Object
-
#initialize(options, &block) ⇒ ValueChanger
constructor
A new instance of ValueChanger.
Constructor Details
#initialize(options, &block) ⇒ ValueChanger
Returns a new instance of ValueChanger.
4 5 6 7 8 9 10 11 |
# File 'lib/hash/value_changer.rb', line 4 def initialize(, &block) @options = { recursive: true, skip_inner: true }.merge() @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
2 3 4 |
# File 'lib/hash/value_changer.rb', line 2 def block @block end |
#options ⇒ Object
Returns the value of attribute options.
2 3 4 |
# File 'lib/hash/value_changer.rb', line 2 def @options end |
Instance Method Details
#change(object) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/hash/value_changer.rb', line 13 def change(object) if object.respond_to?(:change_values) change_hash(object) elsif is_iterable?(object) change_array(object) end end |