Sha256: a773c031a39d0d5d0b7fc31c72ab66827880e8fd95b7e18c3378ed2e800e606e

Contents?: true

Size: 654 Bytes

Versions: 6

Compression:

Stored size: 654 Bytes

Contents

require 'omniauth'

module OmniAuth
  class Builder < ::Rack::Builder
    def initialize(app, &block)
      @app = app
      super(&block)
    end

    def on_failure(&block)
      OmniAuth.config.on_failure = block
    end

    def configure(&block)
      OmniAuth.configure(&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

6 entries across 6 versions & 1 rubygems

Version Path
omniauth-1.0.0 lib/omniauth/builder.rb
omniauth-1.0.0.rc2 lib/omniauth/builder.rb
omniauth-1.0.0.rc1 lib/omniauth/builder.rb
omniauth-1.0.0.beta1 lib/omniauth/builder.rb
omniauth-1.0.0.pr2 lib/omniauth/builder.rb
omniauth-1.0.0.pr1 lib/omniauth/builder.rb