Class: Monolens::Object::Allbut

Inherits:
Object
  • Object
show all
Includes:
Lens
Defined in:
lib/monolens/stdlib/object/allbut.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



10
11
12
13
14
15
16
17
18
19
# File 'lib/monolens/stdlib/object/allbut.rb', line 10

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

  allbut = option(:defn, [])
  arg.delete_if{|k|
    allbut.include?(k) || \
    allbut.include?(k.to_s) || \
    allbut.include?(k.to_sym)
  }
end