Class: Kinda::Core::Functor

Inherits:
BasicObject
Defined in:
lib/core/functor.rb

Overview

Thomas Sawyer’s Functor Class slightly modified for Ruby 1.9 facets.rubyforge.org/apidoc/api/core/classes/Functor.html

Instance Method Summary collapse

Constructor Details

#initialize(&proc) ⇒ Functor

Returns a new instance of Functor.



6
7
8
# File 'lib/core/functor.rb', line 6

def initialize(&proc)
  @proc = proc
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



14
15
16
# File 'lib/core/functor.rb', line 14

def method_missing(method_name, *args, &block)
  @proc.call(method_name, *args, &block)
end

Instance Method Details

#to_procObject



10
11
12
# File 'lib/core/functor.rb', line 10

def to_proc
  @proc
end