Class: MimeActor::Dispatcher::InstanceExec
- Inherits:
-
Object
- Object
- MimeActor::Dispatcher::InstanceExec
- Defined in:
- lib/mime_actor/dispatcher.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #call(target) ⇒ Object
-
#initialize(block, *args) ⇒ InstanceExec
constructor
A new instance of InstanceExec.
Constructor Details
#initialize(block, *args) ⇒ InstanceExec
Returns a new instance of InstanceExec.
38 39 40 41 42 |
# File 'lib/mime_actor/dispatcher.rb', line 38 def initialize(block, *args) @block = block @args = args validate! end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
36 37 38 |
# File 'lib/mime_actor/dispatcher.rb', line 36 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
36 37 38 |
# File 'lib/mime_actor/dispatcher.rb', line 36 def block @block end |
Instance Method Details
#call(target) ⇒ Object
44 45 46 47 |
# File 'lib/mime_actor/dispatcher.rb', line 44 def call(target) filtered_args = block.arity.negative? ? args : args.take(block.arity) target.instance_exec(*filtered_args, &block) end |