Class: Lab42::Behavior

Inherits:
Object show all
Defined in:
lib/lab42/core/behavior.rb,
lib/lab42/core/behavior/proxy.rb

Overview

Thank youn my dear Proxy, for sending me all the information I, the clever guy, who is having all the fun, will make best use of it by being an extremly, yes I said extremly clever callable object representing the methods or instance methods represented by the calls to ‘Object#fn` or `Module#fm`. Did I tell you yet? It is sooooo out not be functional…

Defined Under Namespace

Classes: Proxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



11
12
13
# File 'lib/lab42/core/behavior.rb', line 11

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



11
12
13
# File 'lib/lab42/core/behavior.rb', line 11

def block
  @block
end

#methodObject (readonly)

Returns the value of attribute method.



11
12
13
# File 'lib/lab42/core/behavior.rb', line 11

def method
  @method
end

#receiverObject (readonly)

Returns the value of attribute receiver.



11
12
13
# File 'lib/lab42/core/behavior.rb', line 11

def receiver
  @receiver
end

Instance Method Details

#call(*a, &b) ⇒ Object Also known as: []



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

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

#to_procObject



20
21
22
23
24
25
# File 'lib/lab42/core/behavior.rb', line 20

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