Class: Functor

Inherits:
Object show all
Defined in:
lib/relevance/core_extensions/metaclass.rb

Overview

From /lib/core/facets/functor.rb

Instance Method Summary collapse

Constructor Details

#initialize(&function) ⇒ Functor

Returns a new instance of Functor.



67
68
69
# File 'lib/relevance/core_extensions/metaclass.rb', line 67

def initialize(&function)
  @function = function
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(op, *args, &blk) ⇒ Object



75
76
77
# File 'lib/relevance/core_extensions/metaclass.rb', line 75

def method_missing(op, *args, &blk)
  @function.call(op, *args, &blk)
end

Instance Method Details

#to_procObject



71
72
73
# File 'lib/relevance/core_extensions/metaclass.rb', line 71

def to_proc
  @function
end