class OmniAuth::ProviderRegistry::Registry

Attributes

factory_methods[R]

Public Class Methods

new(factory_methods) click to toggle source
# File lib/omniauth/provider_registry/registry.rb, line 6
def initialize(factory_methods)
  @factory_methods = factory_methods
end

Public Instance Methods

factories_by_name() click to toggle source
# File lib/omniauth/provider_registry/registry.rb, line 15
def factories_by_name
  @factories_by_name ||= factory_methods.each_with_object({}){|f, all|
    name = f.call.name.to_sym
    all[name] = f
  }
end
find(name) click to toggle source
# File lib/omniauth/provider_registry/registry.rb, line 10
def find(name)
  factory = factories_by_name[name.to_sym]
  factory.call if factory
end