Sha256: 7434552335723a51f44c868e24dd28646488888eb6ed2451404638f2fcc81546

Contents?: true

Size: 1009 Bytes

Versions: 25

Compression:

Stored size: 1009 Bytes

Contents

require 'alephant/broker/version'
require 'alephant/broker/request'
require 'alephant/broker/environment'
require 'alephant/broker'

module Alephant
  module Broker

    def self.handle(load_strategy, env)
      Request::Handler.process(load_strategy, env)
    end

    def self.config
      @@configuration
    end

    def self.config=(c)
      @@configuration = c
    end

    class Application
      attr_reader :load_strategy

      def initialize(load_strategy, c = nil)
        Broker.config = c unless c.nil?
        @load_strategy = load_strategy
      end

      def call(env)
        send response_for(environment_for(env))
      end

      def environment_for(env)
        Environment.new env
      end

      def response_for(call_environment)
        Broker.handle(load_strategy, call_environment)
      end

      def send(response)
        [
          response.status,
          response.headers,
          [
            response.content.to_s
          ]
        ]
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
alephant-broker-3.13.0 lib/alephant/broker.rb
alephant-broker-3.12.0 lib/alephant/broker.rb
alephant-broker-3.11.0 lib/alephant/broker.rb
alephant-broker-3.10.2 lib/alephant/broker.rb
alephant-broker-3.10.1 lib/alephant/broker.rb
alephant-broker-3.10.0 lib/alephant/broker.rb
alephant-broker-3.9.2 lib/alephant/broker.rb
alephant-broker-3.9.1 lib/alephant/broker.rb
alephant-broker-3.9.0 lib/alephant/broker.rb
alephant-broker-3.8.0 lib/alephant/broker.rb
alephant-broker-3.7.1 lib/alephant/broker.rb
alephant-broker-3.7.0 lib/alephant/broker.rb
alephant-broker-3.6.1 lib/alephant/broker.rb
alephant-broker-3.6.0 lib/alephant/broker.rb
alephant-broker-3.5.5 lib/alephant/broker.rb
alephant-broker-3.5.4 lib/alephant/broker.rb
alephant-broker-3.5.3 lib/alephant/broker.rb
alephant-broker-3.5.2 lib/alephant/broker.rb
alephant-broker-3.5.1 lib/alephant/broker.rb
alephant-broker-3.5.0 lib/alephant/broker.rb