Sha256: 387170c4e275ca43e4b35397d630b23f7076b049ca5fd148f1a64ef1838edb91
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# encoding: utf-8 require 'state_machine' require 'future-resource' require 'adhearsion/rayo/rayo_node' module Adhearsion module Rayo class CommandNode < RayoNode attribute :request_id, String, default: ->(*) { Adhearsion.new_request_id } def initialize(*args) super @response = FutureResource.new end state_machine :state, :initial => :new do event :request do transition :new => :requested end event :execute do transition :requested => :executing end event :complete do transition :executing => :complete end end def response(timeout = nil) @response.resource timeout end 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 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-3.0.0.rc1 | lib/adhearsion/rayo/command_node.rb |
adhearsion-3.0.0.beta2 | lib/adhearsion/rayo/command_node.rb |
adhearsion-3.0.0.beta1 | lib/adhearsion/rayo/command_node.rb |