Module: OpenAuth2::DelegateToConfig

Included in:
Client, Token
Defined in:
lib/open_auth2/delegate_to_config.rb

Overview

Helper module that Client/Token extend so they can have access to Options methods. We delegate those methods to @config, which should contain Config object.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



8
9
10
11
# File 'lib/open_auth2/delegate_to_config.rb', line 8

def self.extended(base)
  base.send(:attr_accessor, :config)
  base.delegate_to_config
end

Instance Method Details

#delegate_to_configObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/open_auth2/delegate_to_config.rb', line 13

def delegate_to_config
  OpenAuth2::Provider::Base::Keys.each do |key|
    define_method(key) do
      @config.send(key)
    end

    define_method("#{key}=") do |value|
      @config.send("#{key}=", value)
    end
  end
end