Sha256: a9efc7bc141872da12eb2be15456279abeb409f874c881b31f84bdd5d03b5efd

Contents?: true

Size: 808 Bytes

Versions: 17

Compression:

Stored size: 808 Bytes

Contents

require File.dirname(__FILE__) + "/command_handler_chain_link"

class CommandHandlerChainFactory
  @@dsls = {}

  def self.def_dsl(dsl, *command_handler_array)
    @@last_chain_link = nil
    @@chain = nil
    command_handler_array.each do |command_handler|
      Glimmer.logger.debug "Loading #{command_handler.class.to_s}..."
      chain_link = CommandHandlerChainLink.new(command_handler)
      @@last_chain_link.chain_to(chain_link) if @@last_chain_link
      @@last_chain_link = chain_link
      @@chain = chain_link unless @@chain
    end
    @@dsls[dsl] = {
      :last_chain_link => @@last_chain_link,
      :chain => @@chain
    }
  end

  def self.select_dsl(dsl)
    @@last_chain_link = @@dsls[dsl][:last_chain_link]
    @@chain = @@dsls[dsl][:chain]
  end

  def self.chain
    @@chain
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
glimmer-0.3.5 lib/command_handler_chain_factory.rb
glimmer-0.3.4 lib/command_handler_chain_factory.rb
glimmer-0.3.3 lib/command_handler_chain_factory.rb
glimmer-0.3.2 lib/command_handler_chain_factory.rb
glimmer-0.3.1 lib/command_handler_chain_factory.rb
glimmer-0.2.5 lib/command_handler_chain_factory.rb
glimmer-0.2.4 lib/command_handler_chain_factory.rb
glimmer-0.2.3 lib/command_handler_chain_factory.rb
glimmer-0.2.2 lib/command_handler_chain_factory.rb
glimmer-0.2.1 lib/command_handler_chain_factory.rb
glimmer-0.2.0 lib/command_handler_chain_factory.rb
glimmer-0.1.11.SWT4.14 lib/command_handler_chain_factory.rb
glimmer-0.1.11.470 lib/command_handler_chain_factory.rb
glimmer-0.1.10.470 lib/command_handler_chain_factory.rb
glimmer-0.1.9.470 lib/command_handler_chain_factory.rb
glimmer-0.1.8.470 lib/command_handler_chain_factory.rb
glimmer-0.1.5.470 lib/command_handler_chain_factory.rb