Exception: SplitIoClient::BetweenMatcher
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::BetweenMatcher
- Defined in:
- lib/engine/matchers/between_matcher.rb
Instance Attribute Summary collapse
-
#matcher_type ⇒ Object
readonly
Returns the value of attribute matcher_type.
Instance Method Summary collapse
- #equals?(obj) ⇒ Boolean
-
#initialize(attribute_hash) ⇒ BetweenMatcher
constructor
A new instance of BetweenMatcher.
- #match?(key, attributes) ⇒ Boolean
Constructor Details
#initialize(attribute_hash) ⇒ BetweenMatcher
Returns a new instance of BetweenMatcher.
7 8 9 10 11 12 13 |
# File 'lib/engine/matchers/between_matcher.rb', line 7 def initialize(attribute_hash) @matcher_type = "BETWEEN" @attribute = attribute_hash[:attribute] @data_type = attribute_hash[:data_type] @start_value = get_formatted_value attribute_hash[:start_value], true @end_value = get_formatted_value attribute_hash[:end_value], true end |
Instance Attribute Details
#matcher_type ⇒ Object (readonly)
Returns the value of attribute matcher_type.
5 6 7 |
# File 'lib/engine/matchers/between_matcher.rb', line 5 def matcher_type @matcher_type end |
Instance Method Details
#equals?(obj) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/engine/matchers/between_matcher.rb', line 25 def equals?(obj) if obj.nil? false elsif !obj.instance_of?(BetweenMatcher) false elsif self.equal?(obj) true else false end end |
#match?(key, attributes) ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/engine/matchers/between_matcher.rb', line 15 def match?(key, attributes) matches = false if (!attributes.nil? && attributes.key?(@attribute.to_sym)) param_value = get_formatted_value(attributes[@attribute.to_sym]) matches = param_value.is_a?(Integer) ? ((param_value >= @start_value) && (param_value <= @end_value)) : false end matches end |