Class: Regexp::Expression::Quantifier
- Inherits:
-
Object
- Object
- Regexp::Expression::Quantifier
- Defined in:
- lib/regexp_parser/expression/quantifier.rb
Constant Summary collapse
- MODES =
[:greedy, :possessive, :reluctant]
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eq)
-
#initialize(token, text, min, max, mode) ⇒ Quantifier
constructor
A new instance of Quantifier.
- #initialize_copy(orig) ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(token, text, min, max, mode) ⇒ Quantifier
Returns a new instance of Quantifier.
7 8 9 10 11 12 13 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 7 def initialize(token, text, min, max, mode) @token = token @text = text @mode = mode @min = min @max = max end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
5 6 7 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 5 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
5 6 7 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 5 def min @min end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
5 6 7 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 5 def mode @mode end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 5 def text @text end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 5 def token @token end |
Instance Method Details
#==(other) ⇒ Object Also known as: eq
44 45 46 47 48 49 50 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 44 def ==(other) other.class == self.class && other.token == token && other.mode == mode && other.min == min && other.max == max end |
#initialize_copy(orig) ⇒ Object
15 16 17 18 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 15 def initialize_copy(orig) @text = orig.text.dup super end |
#to_h ⇒ Object
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_s ⇒ Object Also known as: to_str
20 21 22 |
# File 'lib/regexp_parser/expression/quantifier.rb', line 20 def to_s text.dup end |