Class: Feedbook::Configuration

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

Constant Summary collapse

INTERVAL_FORMAT =
/\A(\d+)(s|m|h|d)\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ NilClass

Initializes new Configuration object with configuration for program instance

Parameters:

  • opts (defaults to: {})

    {} [Hash] Hash with configuration of interval and suppliers



14
15
16
17
# File 'lib/feedbook/configuration.rb', line 14

def initialize(opts = {})
  @interval    = Helpers::TimeIntervalParser.parse opts.delete('interval')
  @options     = opts
end

Instance Attribute Details

#intervalObject (readonly)

Returns the value of attribute interval.



6
7
8
# File 'lib/feedbook/configuration.rb', line 6

def interval
  @interval
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/feedbook/configuration.rb', line 6

def options
  @options
end

Instance Method Details

#load_notifiersNilClass

Load notifiers configuration

Returns:

  • (NilClass)

    nil



22
23
24
25
26
27
# File 'lib/feedbook/configuration.rb', line 22

def load_notifiers
  options.each do |name, config|
    notifier = Factories::NotifiersFactory.create(name)
    notifier.load_configuration(config) unless notifier.nil?
  end
end