Module: Stoplight::Notifier::Generic

Included in:
IO, Logger, Slack
Defined in:
lib/stoplight/notifier/generic.rb

Overview

rubocop:disable Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#formatterProc (readonly)


7
8
9
# File 'lib/stoplight/notifier/generic.rb', line 7

def formatter
  @formatter
end

Instance Method Details

#initialize(object, formatter = nil) ⇒ Object


11
12
13
14
# File 'lib/stoplight/notifier/generic.rb', line 11

def initialize(object, formatter = nil)
  @object = object
  @formatter = formatter || Default::FORMATTER
end

#notify(light, from_color, to_color, error) ⇒ Object

See Also:


17
18
19
20
21
# File 'lib/stoplight/notifier/generic.rb', line 17

def notify(light, from_color, to_color, error)
  message = formatter.call(light, from_color, to_color, error)
  put(message)
  message
end