Class: Munna::Proxy::Execute

Inherits:
Object
  • Object
show all
Defined in:
lib/munna/proxy/execute.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, object = {}) ⇒ Execute

Returns a new instance of Execute.



4
5
6
7
# File 'lib/munna/proxy/execute.rb', line 4

def initialize(target, object={})
  @target = target
  @object = object
end

Instance Method Details

#nameObject



9
10
11
# File 'lib/munna/proxy/execute.rb', line 9

def name
  @object.is_a?(Proc) ? nil : @object[:name]
end

#valueObject



13
14
15
16
17
18
19
# File 'lib/munna/proxy/execute.rb', line 13

def value
  @value ||= if @object.is_a? Proc
    @object.call
  else
    @target.send @object[:name], *@object[:params]
  end
end