class Floss::Proxy

A {Floss::Proxy} wraps a FSM and runs it on a cluster.

Public Class Methods

new(fsm, options) click to toggle source

@param [Object] fsm The fsm to expose. @param [Hash] options Options as used by {Floss::Node}.

# File lib/floss/proxy.rb, line 8
def initialize(fsm, options)
  @fsm = fsm
  @node = ::Floss::Node.new(options) { |command| fsm.send(*command) }
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source

Executes all methods exposed by the FSM in the cluster.

Calls superclass method
# File lib/floss/proxy.rb, line 14
def method_missing(method, *args, &block)
  raise ArgumentError, "Can not accept blocks." if block_given?
  return super unless respond_to?(method)
  @node.wait_until_ready
  @node.execute([method, *args])
end
respond_to?(method, include_private = false) click to toggle source
# File lib/floss/proxy.rb, line 21
def respond_to?(method, include_private = false)
  @fsm.respond_to?(method, include_private)
end