Class: Wee::LiteralMethodCallback
Overview
A serializable callback.
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(obj, method_id = :call, *args) ⇒ LiteralMethodCallback
constructor
A new instance of LiteralMethodCallback.
Constructor Details
#initialize(obj, method_id = :call, *args) ⇒ LiteralMethodCallback
Returns a new instance of LiteralMethodCallback.
109 110 111 112 |
# File 'lib/wee/core/callback.rb', line 109 def initialize(obj, method_id=:call, *args) @obj, @method_id = obj, method_id @args = args unless args.empty? end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
107 108 109 |
# File 'lib/wee/core/callback.rb', line 107 def obj @obj end |
Instance Method Details
#call(*args) ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/wee/core/callback.rb', line 114 def call(*args) if @args @obj.send(@method_id, *(@args+args)) else @obj.send(@method_id, *args) end end |