Sha256: dbc121829e7289aca15d8f8abc03e13251a948957b48b488611cde5e465f690d

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

require 'bbk/app/matchers/headers'
require 'bbk/app/matchers/payload'
require 'bbk/app/matchers/delivery_info'

module BBK
  module App
    module Matchers
      class Full < Base

        def initialize(*args)
          if args.size == 1
            arg = args[0]
            hrule = arg.fetch(:headers, {})
            prule = arg.fetch(:payload, {})
            drule = arg.fetch(:delivery_info, {})
          else
            hrule, prule, drule = *args
          end

          @hm = Headers.new(hrule)
          @pm = Payload.new(prule)
          @dm = DeliveryInfo.new(drule)
          @rule = [hrule, prule, drule]
        end

        def match(headers, payload, delivery_info, *_args)
          return unless (hr = @hm.match(headers, payload, delivery_info))
          return unless (pr = @pm.match(headers, payload, delivery_info))
          return unless (dr = @dm.match(headers, payload, delivery_info))

          [hr, pr, dr]
        rescue StandardError
          nil
        end


      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bbk-app-1.1.1.273627 lib/bbk/app/matchers/full.rb
bbk-app-1.1.1.273338 lib/bbk/app/matchers/full.rb
bbk-app-1.1.1.273312 lib/bbk/app/matchers/full.rb
bbk-app-1.1.1.273294 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.219406 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.216998 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.204569 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.200751 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.200186 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.199675 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.199604 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.199389 lib/bbk/app/matchers/full.rb
bbk-app-1.1.0.199383 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.152254 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.141716 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.80957 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.79514 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.79241 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.78020 lib/bbk/app/matchers/full.rb
bbk-app-1.0.0.72920 lib/bbk/app/matchers/full.rb