Class: Monolens::Object::Values
- Inherits:
-
Object
- Object
- Monolens::Object::Values
- Includes:
- Lens
- Defined in:
- lib/monolens/object/values.rb
Instance Attribute Summary
Attributes included from Lens
Instance Method Summary collapse
Methods included from Lens
Methods included from Lens::FetchSupport
Instance Method Details
#call(arg, world = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/monolens/object/values.rb', line 6 def call(arg, world = {}) is_hash!(arg, world) lenses = option(:lenses) result = arg.dup arg.each_pair do |attr, value| deeper(world, attr) do |w| begin result[attr] = lenses.call(value, w) rescue Monolens::LensError => ex strategy = option(:on_error, :fail) handle_error(strategy, ex, result, attr, value, world) end end end result end |