Sha256: 55d2dc5c54d8d9589218e56ce109ceb8b04edcf090b0df19dae8ce99a049ca11

Contents?: true

Size: 689 Bytes

Versions: 10

Compression:

Stored size: 689 Bytes

Contents

# encoding: utf-8
require 'state_machine'

module Punchblock
  class CommandNode < RayoNode

    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!
    end
  end # CommandNode
end # Punchblock

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
punchblock-2.2.2 lib/punchblock/command_node.rb
punchblock-2.2.1 lib/punchblock/command_node.rb
punchblock-2.2.0 lib/punchblock/command_node.rb
punchblock-2.1.1 lib/punchblock/command_node.rb
punchblock-2.1.0 lib/punchblock/command_node.rb
punchblock-2.0.2 lib/punchblock/command_node.rb
punchblock-2.0.1 lib/punchblock/command_node.rb
punchblock-2.0.0 lib/punchblock/command_node.rb
punchblock-2.0.0.beta2 lib/punchblock/command_node.rb
punchblock-2.0.0.beta1 lib/punchblock/command_node.rb