Class: Myoack::KeyConfig

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

Direct Known Subclasses

OAuth2Config, OAuthConfig

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = Config) ⇒ KeyConfig

Returns a new instance of KeyConfig.



39
40
41
42
43
44
# File 'lib/myoack/key_config.rb', line 39

def initialize config=Config
  @config = config
  self.id = self.class.id
  self.type = self.class.type
  self.class.config_defaults.each { |k, v| send(:"#{k}=", v) }
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



46
47
48
# File 'lib/myoack/key_config.rb', line 46

def config
  @config
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/myoack/key_config.rb', line 7

def id
  @id
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/myoack/key_config.rb', line 8

def type
  @type
end

Class Method Details

.config_defaultsObject



26
27
28
# File 'lib/myoack/key_config.rb', line 26

def self.config_defaults
  @config_defaults ||= {}
end

.default(key, value) ⇒ Object



30
31
32
# File 'lib/myoack/key_config.rb', line 30

def self.default key, value
  config_defaults[key.to_s] = value
end

.id(*a) ⇒ Object Also known as: auto_config



10
11
12
13
14
15
16
# File 'lib/myoack/key_config.rb', line 10

def self.id *a
  if a.empty?
    @id
  else
    @id = a[0].to_s
  end
end

.type(*a) ⇒ Object Also known as: config_type



18
19
20
21
22
23
24
# File 'lib/myoack/key_config.rb', line 18

def self.type *a
  if a.empty?
    @type
  else
    @type = a[0].to_s
  end
end