Class: Punchblock::CommandNode

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

Instance Attribute Summary

Attributes inherited from RayoNode

#call_id, #client, #component_id, #connection, #original_component

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, #inspect_attributes, register, #source

Constructor Details

#initialize(*args) ⇒ CommandNode

Returns a new instance of CommandNode.



12
13
14
15
# File 'lib/punchblock/command_node.rb', line 12

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

Class Method Details

.new(options = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/punchblock/command_node.rb', line 5

def self.new(options = {})
  super().tap do |new_node|
    new_node.call_id = options[:call_id]
    new_node.component_id = options[:component_id]
  end
end

Instance Method Details

#response(timeout = nil) ⇒ Object



36
37
38
# File 'lib/punchblock/command_node.rb', line 36

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

#response=(other) ⇒ Object



40
41
42
43
44
# File 'lib/punchblock/command_node.rb', line 40

def response=(other)
  return if @response.set_yet?
  @response.resource = other
  execute!
end

#write_attr(*args) ⇒ Object

Raises:

  • (StandardError)


31
32
33
34
# File 'lib/punchblock/command_node.rb', line 31

def write_attr(*args)
  raise StandardError, "Cannot alter attributes of a requested command" unless new?
  super
end