Class: BBK::App::Matchers::Payload
- Defined in:
- lib/bbk/app/matchers/payload.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(rule) ⇒ Payload
constructor
A new instance of Payload.
- #match(_headers, payload, _delivery_info = nil, *_args) ⇒ Object
Methods inherited from Base
#==, #eql?, #hash, #keys_deep, #match_impl
Constructor Details
#initialize(rule) ⇒ Payload
Returns a new instance of Payload.
8 9 10 |
# File 'lib/bbk/app/matchers/payload.rb', line 8 def initialize(rule) @rule = rule.with_indifferent_access end |
Instance Method Details
#match(_headers, payload, _delivery_info = nil, *_args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/bbk/app/matchers/payload.rb', line 12 def match(_headers, payload, _delivery_info = nil, *_args) payload = JSON(payload) if payload&.is_a?(String) match_impl(@rule, payload.with_indifferent_access) rescue StandardError nil end |