Class: Regexp::Expression::Quantifier

Inherits:
Object
  • Object
show all
Defined in:
lib/regexp_parser/expression/quantifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, text, min, max, mode) ⇒ Quantifier

Returns a new instance of Quantifier.



6
7
8
9
10
11
12
# File 'lib/regexp_parser/expression/quantifier.rb', line 6

def initialize(token, text, min, max, mode)
  @token = token
  @text  = text
  @mode  = mode
  @min   = min
  @max   = max
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



4
5
6
# File 'lib/regexp_parser/expression/quantifier.rb', line 4

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



4
5
6
# File 'lib/regexp_parser/expression/quantifier.rb', line 4

def min
  @min
end

#modeObject (readonly)

Returns the value of attribute mode.



4
5
6
# File 'lib/regexp_parser/expression/quantifier.rb', line 4

def mode
  @mode
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/regexp_parser/expression/quantifier.rb', line 4

def text
  @text
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/regexp_parser/expression/quantifier.rb', line 4

def token
  @token
end

Instance Method Details

#cloneObject



14
15
16
17
18
# File 'lib/regexp_parser/expression/quantifier.rb', line 14

def clone
  copy = self.dup
  copy.instance_variable_set(:@text, @text.dup)
  copy
end

#to_hObject



25
26
27
28
29
30
31
32
33
# File 'lib/regexp_parser/expression/quantifier.rb', line 25

def to_h
  {
    :token => token,
    :text  => text,
    :mode  => mode,
    :min   =>  min,
    :max   =>  max
  }
end

#to_sObject Also known as: to_str



20
21
22
# File 'lib/regexp_parser/expression/quantifier.rb', line 20

def to_s
  @text.dup
end