Exception: SplitIoClient::UserDefinedSegmentMatcher
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::UserDefinedSegmentMatcher
- Defined in:
- lib/engine/matchers/user_defined_segment_matcher.rb
Overview
class to implement the user defined matcher
Instance Attribute Summary collapse
-
#matcher_type ⇒ Object
readonly
Returns the value of attribute matcher_type.
Instance Method Summary collapse
-
#equals?(obj) ⇒ Boolean
evaluates if the given object equals the matcher.
-
#initialize(segments_repository, segment_name) ⇒ UserDefinedSegmentMatcher
constructor
A new instance of UserDefinedSegmentMatcher.
-
#match?(key, attributes) ⇒ boolean
evaluates if the key matches the matcher.
Constructor Details
#initialize(segments_repository, segment_name) ⇒ UserDefinedSegmentMatcher
Returns a new instance of UserDefinedSegmentMatcher.
10 11 12 13 14 |
# File 'lib/engine/matchers/user_defined_segment_matcher.rb', line 10 def initialize(segments_repository, segment_name) @matcher_type = "IN_SEGMENT" @segments_repository = segments_repository @segment_name = segment_name end |
Instance Attribute Details
#matcher_type ⇒ Object (readonly)
Returns the value of attribute matcher_type.
8 9 10 |
# File 'lib/engine/matchers/user_defined_segment_matcher.rb', line 8 def matcher_type @matcher_type end |
Instance Method Details
#equals?(obj) ⇒ Boolean
evaluates if the given object equals the matcher
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/engine/matchers/user_defined_segment_matcher.rb', line 32 def equals?(obj) if obj.nil? false elsif !obj.instance_of?(UserDefinedSegmentMatcher) false elsif self.equal?(obj) true else false end end |
#match?(key, attributes) ⇒ boolean
evaluates if the key matches the matcher
22 23 24 |
# File 'lib/engine/matchers/user_defined_segment_matcher.rb', line 22 def match?(key, attributes) @segments_repository.in_segment?(@segment_name, key) end |