Class: Myoack::KeyConfig
- Inherits:
-
Object
- Object
- Myoack::KeyConfig
- Defined in:
- lib/myoack/key_config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .config_defaults ⇒ Object
- .default(key, value) ⇒ Object
- .id(*a) ⇒ Object (also: auto_config)
- .type(*a) ⇒ Object (also: config_type)
Instance Method Summary collapse
-
#initialize(config = Config) ⇒ KeyConfig
constructor
A new instance of KeyConfig.
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
#config ⇒ Object
Returns the value of attribute config.
46 47 48 |
# File 'lib/myoack/key_config.rb', line 46 def config @config end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/myoack/key_config.rb', line 7 def id @id end |
#type ⇒ Object
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_defaults ⇒ Object
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 |