Class: LunaPark::Notifiers::TaggedLog::Options

Inherits:
Values::Compound show all
Defined in:
lib/luna_park/notifiers/tagged_log/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Values::Compound

#==

Methods included from Extensions::Wrappable

#wrap

Constructor Details

#initialize(attrs = {}) ⇒ Options

Returns a new instance of Options.



11
12
13
14
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 11

def initialize(attrs = {})
  logger_conf_error if config_incorrect?(attrs)
  set_attributes attrs
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



9
10
11
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 9

def app
  @app
end

#app_envObject

Returns the value of attribute app_env.



9
10
11
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 9

def app_env
  @app_env
end

#default_tagObject

Returns the value of attribute default_tag.



9
10
11
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 9

def default_tag
  @default_tag
end

#instanceObject

Returns the value of attribute instance.



9
10
11
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 9

def instance
  @instance
end

#min_lvlObject

Returns the value of attribute min_lvl.



9
10
11
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 9

def min_lvl
  @min_lvl
end

Instance Method Details

#merge(other) ⇒ Object



30
31
32
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 30

def merge(other)
  dup.merge!(other)
end

#merge!(other) ⇒ Notifiers::Log::Options

Parameters:

  • other (Notifiers::Log::Options, Hash)

Returns:

  • (Notifiers::Log::Options)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 18

def merge!(other)
  other = self.class.wrap(other)

  self.default_tag ||= other.default_tag
  self.app ||= other.app
  self.app_env ||= other.app_env
  self.instance ||= other.instance
  self.min_lvl ||= other.min_lvl

  self
end

#to_hObject



34
35
36
37
38
39
40
41
42
# File 'lib/luna_park/notifiers/tagged_log/options.rb', line 34

def to_h
  {
    default_tag: default_tag,
    app: app,
    app_env: app_env,
    instance: instance,
    min_lvl: min_lvl
  }
end