Class: Darthjee::CoreExt::Hash::ValueChanger
- Defined in:
- lib/darthjee/core_ext/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.
9 10 11 12 13 14 15 16 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 9 def initialize(, &block) @options = { recursive: true, skip_inner: true }.merge() @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
7 8 9 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 7 def block @block end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 7 def @options end |
Instance Method Details
#change(object) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 18 def change(object) if object.respond_to?(:change_values) change_hash(object) elsif iterable?(object) change_array(object) end end |