Class: Contrek::Matchers::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/contrek/matchers/matcher.rb

Direct Known Subclasses

MatcherHsb, ValueNotMatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Matcher

Returns a new instance of Matcher.



7
8
9
10
11
# File 'lib/contrek/matchers/matcher.rb', line 7

def initialize(value)
  @value_is = value
  @values = []
  @counters = {}
end

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



6
7
8
# File 'lib/contrek/matchers/matcher.rb', line 6

def counters
  @counters
end

#valuesObject (readonly)

Returns the value of attribute values.



6
7
8
# File 'lib/contrek/matchers/matcher.rb', line 6

def values
  @values
end

Instance Method Details

#match?(value) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/contrek/matchers/matcher.rb', line 13

def match?(value)
  @value_is == value
end

#unmatch?(value) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/contrek/matchers/matcher.rb', line 17

def unmatch?(value)
  !match?(value)
end