Class: Callback
Overview
A simple __send__ based callback implementation, simply Object Orients something equivalent to:
lambda { |*args| object.__send__ method, *args }
Class Attribute Summary collapse
-
.extension_loaded ⇒ Object
readonly
Returns the value of attribute extension_loaded.
Instance Method Summary collapse
- #call(args) ⇒ Object
-
#initialize(*args) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(*args) ⇒ Callback
Returns a new instance of Callback.
46 47 48 |
# File 'ext/mri_callback/mri_callback.c', line 46 def initialize(object, method) @object, @method = object, method end |
Class Attribute Details
.extension_loaded ⇒ Object (readonly)
Returns the value of attribute extension_loaded.
11 12 13 |
# File 'lib/cb.rb', line 11 def extension_loaded @extension_loaded end |
Instance Method Details
#call(args) ⇒ Object
69 70 71 |
# File 'ext/mri_callback/mri_callback.c', line 69 def call(*args) @object.__send__(@method, *args) end |