Class: Clarion::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



16
17
18
19
20
21
22
23
# File 'lib/clarion/config.rb', line 16

def initialize(options={})
  @options = options

  # Validation
  self.class.options.each do |m|
    send(m)
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



25
26
27
# File 'lib/clarion/config.rb', line 25

def options
  @options
end

Class Method Details

.option(meth) ⇒ Object



7
8
9
# File 'lib/clarion/config.rb', line 7

def option(meth)
  options << meth
end

.optionsObject



11
12
13
# File 'lib/clarion/config.rb', line 11

def options
  @options ||= []
end

Instance Method Details

#counter_optionsObject



57
58
59
# File 'lib/clarion/config.rb', line 57

def counter_options
  @counter_options ||= @options.fetch(:counter).dup.tap { |_| _.delete(:kind) }
end

#store_optionsObject



47
48
49
# File 'lib/clarion/config.rb', line 47

def store_options
  @store_options ||= @options.fetch(:store).dup.tap { |_| _.delete(:kind) }
end