Class: Functor
Overview
From /lib/core/facets/functor.rb
Instance Method Summary collapse
-
#initialize(&function) ⇒ Functor
constructor
A new instance of Functor.
- #method_missing(op, *args, &blk) ⇒ Object
- #to_proc ⇒ Object
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_proc ⇒ Object
71 72 73 |
# File 'lib/relevance/core_extensions/metaclass.rb', line 71 def to_proc @function end |