Class: Monolens::Core::Digs

Inherits:
Object
  • Object
show all
Includes:
Lens
Defined in:
lib/monolens/stdlib/core/digs.rb

Instance Attribute Summary

Attributes included from Lens

#options

Instance Method Summary collapse

Methods included from Lens

#fail!, included, #initialize

Methods included from Lens::FetchSupport

#fetch_on

Instance Method Details

#call(arg, world = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/monolens/stdlib/core/digs.rb', line 14

def call(arg, world = {})
  to_dig = option(:defn, [])
  to_dig.map {|digging|
    digging.inject(arg) do |memo, part|
      dig_on(part, memo, world)
    end
  }
end