Class: Omnigollum::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/omnigollum.rb

Overview

Config class provides default values for omnigollum configuration, and an array of all providers which have been enabled if a omniauth config block is passed to eval_omniauth_config.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



158
159
160
# File 'lib/omnigollum.rb', line 158

def initialize
  @default_options = self.class.default_options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

Catches missing methods we haven’t implemented, but which omniauth accepts in its config block.

args - Arbitrary list of arguments



184
# File 'lib/omnigollum.rb', line 184

def method_missing(*args); end

Class Attribute Details

.default_optionsObject

Returns the value of attribute default_options.



122
123
124
# File 'lib/omnigollum.rb', line 122

def default_options
  @default_options
end

Instance Attribute Details

#default_optionsObject

Returns the value of attribute default_options.



121
122
123
# File 'lib/omnigollum.rb', line 121

def default_options
  @default_options
end

Instance Method Details

#eval_omniauth_config(&block) ⇒ Object

Evaluate procedure calls in an omniauth config block/proc in the context of this class.

This allows us to learn about omniauth config items that would otherwise be inaccessible.

block - Omniauth proc or block



176
177
178
# File 'lib/omnigollum.rb', line 176

def eval_omniauth_config(&block)
  self.instance_eval(&block)
end

#provider(name, *args) ⇒ Object

Register provider name

name - Provider symbol args - Arbitrary arguments



166
167
168
# File 'lib/omnigollum.rb', line 166

def provider(name, *args)
  @default_options[:provider_names].push name
end