lib/lopata/condition.rb in lopata-0.1.13 vs lib/lopata/condition.rb in lopata-0.1.14
- old
+ new
@@ -1,31 +1,31 @@
-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?
- when TrueClass, FalseClass
- condition
- else
- metadata[condition]
- end
- end
-
- end
+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?
+ when TrueClass, FalseClass
+ condition
+ else
+ metadata[condition]
+ end
+ end
+
+ end
end
\ No newline at end of file