Class: Callback

Inherits:
Object show all
Defined in:
lib/cb.rb,
ext/mri_callback/mri_callback.c

Overview

A simple __send__ based callback implementation, simply Object Orients something equivalent to:

lambda { |*args| object.__send__ method, *args }

Class Attribute Summary collapse

Instance Method Summary collapse

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_loadedObject (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