app/mrr.rb
# Returns a matched SleepWarm::Rule based on the input
#
# @param [Hash] input
# @options input [String] :method HTTP method
# @options input [String] :uri URI
# @options input [String] :header HTTP header
# @options input [String] :body HTTP body
# @return [SleepWarm::Rule, nil] The matched rule or nil if there is no matched one.
Returns a matched SleepWarm::Rule based on the input
Returns a matched SleepWarm :: Rule based on the input
def find(input = { method: nil, uri: nil, header: nil, body: nil })
      input = input.compact.map { |k, v| [k.to_s, v] }.to_h
      matched = valid_rules.select do |rule|
        rule.trigger.all? do |k, v|
          input.dig(k)&.match?(v)
        end
      end
      matched.empty? ? nil : matched.last
    end
def find ( input = { method : nil , uri : nil , header : nil , body : nil } ) input = input . compact . map { | k , v | [ k . to_s , v ] } . to_h matched = valid_rules . select do | rule | rule . trigger . all? do | k , v | input . dig ( k ) &. match? ( v ) end end matched . empty? ? nil : matched . last end
Returns a matched SleepWarm::Rule based on the input
Returns a matched SleepWarm :: Rule based on the input
# if there are multiple muthecd rules, return the last one.
The matched rule or nil if there is no matched one.
The matched rule or nil if there is no matched one .
SleepWarm::Rule, nil
input
<not_specific>
<not_specific>
None
options
input [String] :method HTTP method
input [ String ] : method HTTP method
options
input [String] :uri URI
input [ String ] : uri URI
options
input [String] :header HTTP header
input [ String ] : header HTTP header
options
input [String] :body HTTP body
input [ String ] : body HTTP body