Class: Slack::Notifier::PayloadMiddleware::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/slack-notifier/payload_middleware/base.rb

Direct Known Subclasses

FormatAttachments, FormatMessage

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notifier, opts = {}) ⇒ Base

Returns a new instance of Base.



22
23
24
25
# File 'lib/slack-notifier/payload_middleware/base.rb', line 22

def initialize notifier, opts={}
  @notifier = notifier
  @options  = self.class.default_opts.merge opts
end

Instance Attribute Details

#notifierObject (readonly)

Returns the value of attribute notifier.



20
21
22
# File 'lib/slack-notifier/payload_middleware/base.rb', line 20

def notifier
  @notifier
end

#optionsObject (readonly)

Returns the value of attribute options.



20
21
22
# File 'lib/slack-notifier/payload_middleware/base.rb', line 20

def options
  @options
end

Class Method Details

.default_optsObject



15
16
17
# File 'lib/slack-notifier/payload_middleware/base.rb', line 15

def default_opts
  @default_opts ||= {}
end

.middleware_name(name) ⇒ Object



7
8
9
# File 'lib/slack-notifier/payload_middleware/base.rb', line 7

def middleware_name name
  PayloadMiddleware.register self, name.to_sym
end

.options(default_opts) ⇒ Object



11
12
13
# File 'lib/slack-notifier/payload_middleware/base.rb', line 11

def options default_opts
  @default_opts = default_opts
end

Instance Method Details

#call(payload = {}) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument

Raises:

  • (NoMethodError)


28
29
30
# File 'lib/slack-notifier/payload_middleware/base.rb', line 28

def call payload={}
  raise NoMethodError, "method `call` not defined for class #{self.class}"
end