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.



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

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

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



4
5
6
# File 'lib/contrek/matchers/matcher.rb', line 4

def counters
  @counters
end

#valuesObject (readonly)

Returns the value of attribute values.



4
5
6
# File 'lib/contrek/matchers/matcher.rb', line 4

def values
  @values
end

Instance Method Details

#match?(value) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/contrek/matchers/matcher.rb', line 11

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

#unmatch?(value) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/contrek/matchers/matcher.rb', line 15

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