Class: Machete::Matchers::Quantifier

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matcher, min, max, step) ⇒ Quantifier

Returns a new instance of Quantifier.



7
8
9
# File 'lib/machete/matchers.rb', line 7

def initialize(matcher, min, max, step)
  @matcher, @min, @max, @step = matcher, min, max, step
end

Instance Attribute Details

#matcherObject (readonly)

:min should be always set, :max can be nil (meaning infinity)



5
6
7
# File 'lib/machete/matchers.rb', line 5

def matcher
  @matcher
end

#maxObject (readonly)

:min should be always set, :max can be nil (meaning infinity)



5
6
7
# File 'lib/machete/matchers.rb', line 5

def max
  @max
end

#minObject (readonly)

:min should be always set, :max can be nil (meaning infinity)



5
6
7
# File 'lib/machete/matchers.rb', line 5

def min
  @min
end

#stepObject (readonly)

:min should be always set, :max can be nil (meaning infinity)



5
6
7
# File 'lib/machete/matchers.rb', line 5

def step
  @step
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/machete/matchers.rb', line 11

def ==(other)
  other.instance_of?(self.class) &&
    @matcher == other.matcher &&
    @min == other.min &&
    @max == other.max &&
    @step == other.step
end