Sha256: 72e8e66c164e78683e7a80f02e490fb01acad665b08207cf38f3a51aba341002

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

module Merb
  
  module Rack
    
    class Adapter

      class << self
        # Get a rack adapter by id. 
        # ==== Parameters
        # id<String>:: The identifier of the Rack adapter class to retrieve.
        #
        # ==== Returns.
        # Class:: The adapter class.
        def get(id)
          if @adapters[id.to_s]
            Object.full_const_get(@adapters[id.to_s])
          else
            Merb.fatal! "The adapter #{id} did not exist"
          end
        end

        # Registers a new Rack adapter.
        #
        # ==== Parameters
        # ids<Array>:: Identifiers by which this adapter is recognized by.
        # adapter_class<Class>:: The Rack adapter class.
        def register(ids, adapter_class)
          @adapters ||= Hash.new
          ids.each { |id| @adapters[id] = "Merb::Rack::#{adapter_class}" }
        end
      end # class << self
      
    end # Adapter
    
    # Register some Rack adapters
    Adapter.register %w{ebb},            :Ebb
    Adapter.register %w{emongrel},       :EventedMongrel
    Adapter.register %w{fastcgi fcgi},   :FastCGI
    Adapter.register %w{irb},            :Irb
    Adapter.register %w{mongrel},        :Mongrel  
    Adapter.register %w{runner},         :Runner
    Adapter.register %w{smongrel swift}, :SwiftipliedMongrel
    Adapter.register %w{thin},           :Thin
    Adapter.register %w{thin-turbo tt},  :ThinTurbo
    Adapter.register %w{webrick},        :WEBrick
    
  end # Rack
end # Merb

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/merb-core-0.9.14/lib/merb-core/rack/adapter.rb
merb-core-0.9.10 lib/merb-core/rack/adapter.rb
merb-core-0.9.12 lib/merb-core/rack/adapter.rb
merb-core-0.9.13 lib/merb-core/rack/adapter.rb
merb-core-0.9.11 lib/merb-core/rack/adapter.rb
merb-core-0.9.9 lib/merb-core/rack/adapter.rb