Class: It

Inherits:
BasicObject
Defined in:
lib/epitools/its.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeIt

undef_method( *(instance_methods - [“__id__”, “__send__”]) )


31
32
33
# File 'lib/epitools/its.rb', line 31

def initialize
  @methods = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object


35
36
37
38
# File 'lib/epitools/its.rb', line 35

def method_missing(*args, &block)
  @methods << [args, block] unless args == [:respond_to?, :to_proc]
  self
end

Instance Method Details

#to_procObject


40
41
42
43
44
45
46
# File 'lib/epitools/its.rb', line 40

def to_proc
  lambda do |obj|
    @methods.inject(obj) do |current,(args,block)|
      current.send(*args, &block)
    end
  end
end