Class: Monolens::Object::Merge

Inherits:
Object
  • Object
show all
Includes:
Lens
Defined in:
lib/monolens/stdlib/object/merge.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(input, world = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/monolens/stdlib/object/merge.rb', line 12

def call(input, world = {})
  is_hash!(input, world)

  v1, v2 = input, option(:defn, {})
  if deep?
    deep_merge(v1, v2, world, priority_at_input?)
  else
    normal_merge(v1, v2, world, priority_at_input?)
  end
end