Class: Notiffany::Notifier::Config

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

Overview

Configuration class for Notifier

Constant Summary collapse

DEFAULTS =
{ notify: true }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Config

Returns a new instance of Config.



13
14
15
16
17
18
19
# File 'lib/notiffany/notifier/config.rb', line 13

def initialize(opts)
  options = DEFAULTS.merge(opts)
  @env_namespace = opts.fetch(:namespace, "notiffany")
  @logger = _setup_logger(options)
  @notify = options[:notify]
  @notifiers = opts.fetch(:notifiers, {})
end

Instance Attribute Details

#env_namespaceObject (readonly)

Returns the value of attribute env_namespace.



9
10
11
# File 'lib/notiffany/notifier/config.rb', line 9

def env_namespace
  @env_namespace
end

#loggerObject (readonly)

Returns the value of attribute logger.



10
11
12
# File 'lib/notiffany/notifier/config.rb', line 10

def logger
  @logger
end

#notifiersObject (readonly)

Returns the value of attribute notifiers.



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

def notifiers
  @notifiers
end

Instance Method Details

#notify?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/notiffany/notifier/config.rb', line 21

def notify?
  @notify
end