Class: Punchblock::CommandNode

Inherits:
RayoNode show all
Defined in:
lib/punchblock/command_node.rb

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from RayoNode

#==, class_from_registration, from_xml, #inherit, #inspect, #rayo_attributes, #rayo_children, register, #source, #to_rayo, #to_xml

Constructor Details

#initialize(*args) ⇒ CommandNode

Returns a new instance of CommandNode.



9
10
11
12
# File 'lib/punchblock/command_node.rb', line 9

def initialize(*args)
  super
  @response = FutureResource.new
end

Instance Method Details

#response(timeout = nil) ⇒ Object



28
29
30
# File 'lib/punchblock/command_node.rb', line 28

def response(timeout = nil)
  @response.resource timeout
end

#response=(other) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/punchblock/command_node.rb', line 32

def response=(other)
  return if @response.set_yet?
  @response.resource = other
  execute!
rescue StateMachine::InvalidTransition => e
  e.message << " for command #{self}"
  raise e
rescue FutureResource::ResourceAlreadySetException
end