Class: Lab42::Behavior::SendBehavior

Inherits:
Object
  • Object
show all
Includes:
Lab42::Behavior
Defined in:
lib/lab42/core/behavior/send_behavior.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Composition

#|

Methods included from Negation

#negated

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/lab42/core/behavior/send_behavior.rb', line 5

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



5
6
7
# File 'lib/lab42/core/behavior/send_behavior.rb', line 5

def block
  @block
end

#methodObject (readonly)

Returns the value of attribute method.



5
6
7
# File 'lib/lab42/core/behavior/send_behavior.rb', line 5

def method
  @method
end

Instance Method Details

#arityObject



7
# File 'lib/lab42/core/behavior/send_behavior.rb', line 7

def arity; -1 end

#call(rcv, *a, &b) ⇒ Object



9
10
11
# File 'lib/lab42/core/behavior/send_behavior.rb', line 9

def call rcv, *a, &b
  rcv.send( method, *(a+args), &(b||block) )
end

#to_procObject



13
14
15
16
17
# File 'lib/lab42/core/behavior/send_behavior.rb', line 13

def to_proc
  -> rcv, *a, &b do
    rcv.send( method, *(a+args), &(b||block) )
  end
end