Sha256: c997064e32b4dd7b4816b183e2ccc23cd0d6648a595544d570e1cea89bafe908

Contents?: true

Size: 525 Bytes

Versions: 5

Compression:

Stored size: 525 Bytes

Contents

require 'omniauth/core'

module OmniAuth
  class Builder < Rack::Builder
    def initialize(app, &block)
      @app = app
      super(&block)
    end
    
    def provider(klass, *args, &block)
      if klass.is_a?(Class)
        middleware = klass
      else
        middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
      end
      
      use middleware, *args, &block
    end
    
    def call(env)
      @ins << @app unless @ins.include?(@app)
      to_app.call(env)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oa-core-0.1.2 lib/omniauth/builder.rb
oa-core-0.1.1 lib/omniauth/builder.rb
oa-core-0.1.0 lib/omniauth/builder.rb
oa-core-0.0.5 lib/omniauth/builder.rb
oa-core-0.0.4 lib/omniauth/builder.rb