Sha256: ce0485b91a9cfc8a058714b751c767f10eb553857e82557de33c7dbc16a128c9
Contents?: true
Size: 664 Bytes
Versions: 5
Compression:
Stored size: 664 Bytes
Contents
module Lopata # @private class Condition attr_reader :condition, :positive def initialize(condition, positive: true) @condition, @positive = condition, positive end alias positive? positive def match?(scenario) matched = match_metadata?(scenario) positive? ? matched : !matched end def match_metadata?(scenario) metadata = scenario.metadata case condition when Hash condition.keys.all? { |k| metadata[k] == condition[k] } when Array condition.map { |key| metadata[key] }.all? else metadata[condition] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lopata-0.1.10 | lib/lopata/condition.rb |
lopata-0.1.9 | lib/lopata/condition.rb |
lopata-0.1.8 | lib/lopata/condition.rb |
lopata-0.1.7 | lib/lopata/condition.rb |
lopata-0.1.6 | lib/lopata/condition.rb |