Class: Darthjee::CoreExt::Hash::ValueChanger Private
- Defined in:
- lib/darthjee/core_ext/hash/value_changer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class responsible for changing values on a hash
Instance Method Summary collapse
-
#change(object) ⇒ Object
private
Change the given object.
-
#initialize(recursive: true, skip_inner: true, &block) ⇒ ValueChanger
constructor
private
A new instance of ValueChanger.
Constructor Details
#initialize(recursive: true, skip_inner: true, &block) ⇒ ValueChanger
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ValueChanger.
45 46 47 48 49 50 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 45 def initialize(recursive: true, skip_inner: true, &block) @recursive = recursive @skip_inner = skip_inner @block = block end |
Instance Method Details
#change(object) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Change the given object
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/darthjee/core_ext/hash/value_changer.rb', line 111 def change(object) if object.is_a?(Hash) change_hash(object) elsif object.is_a?(Array) change_array(object) elsif iterable?(object) change_iterator(object) else new_value(object) end end |