Class: Dingding::Notifier::PayloadMiddleware::Base

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

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/dingding-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/dingding-notifier/payload_middleware/base.rb', line 20

def notifier
  @notifier
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

.default_optsObject



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

def default_opts
  @default_opts ||= {}
end

.middleware_name(name) ⇒ Object



7
8
9
# File 'lib/dingding-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/dingding-notifier/payload_middleware/base.rb', line 11

def options default_opts
  @default_opts = default_opts
end

Instance Method Details

#call(_payload = {}) ⇒ Object

Raises:

  • (NoMethodError)


27
28
29
# File 'lib/dingding-notifier/payload_middleware/base.rb', line 27

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