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.



113
114
115
# File 'lib/omnigollum.rb', line 113

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



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

def method_missing(*args); end

Class Attribute Details

.default_optionsObject

Returns the value of attribute default_options.



90
91
92
# File 'lib/omnigollum.rb', line 90

def default_options
  @default_options
end

Instance Attribute Details

#default_optionsObject

Returns the value of attribute default_options.



89
90
91
# File 'lib/omnigollum.rb', line 89

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



131
132
133
# File 'lib/omnigollum.rb', line 131

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

#provider(name, *args) ⇒ Object

Register provider name

name - Provider symbol args - Arbitrary arguments



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

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