Class: Regexp::Expression::CharacterSet
- Inherits:
-
Subexpression
- Object
- Base
- Subexpression
- Regexp::Expression::CharacterSet
- Defined in:
- lib/regexp_parser/expression/classes/character_set.rb,
lib/regexp_parser/expression/classes/character_set/range.rb,
lib/regexp_parser/expression/classes/character_set/intersection.rb
Defined Under Namespace
Classes: IntersectedSequence, Intersection, Range
Instance Attribute Summary collapse
-
#closed ⇒ Object
(also: #closed?)
Returns the value of attribute closed.
-
#negative ⇒ Object
(also: #negative?, #negated?)
Returns the value of attribute negative.
Attributes inherited from Subexpression
Attributes inherited from Base
#conditional_level, #level, #nesting_level, #options, #quantifier, #set_level, #text, #token, #ts, #type
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(token, options = {}) ⇒ CharacterSet
constructor
A new instance of CharacterSet.
- #negate ⇒ Object
- #to_s(format = :full) ⇒ Object
Methods inherited from Subexpression
#<<, #dig, #each_expression, #flat_map, #initialize_copy, #inner_match_length, #match_length, #strfregexp_tree, #te, #to_h, #traverse
Methods inherited from Base
#ascii_classes?, #attributes, #base_length, #case_insensitive?, #coded_offset, #default_classes?, #free_spacing?, #full_length, #greedy?, #initialize_copy, #is?, #match, #match?, #multiline?, #offset, #one_of?, #possessive?, #quantified?, #quantifier_affix, #quantify, #quantity, #reluctant?, #repetitions, #strfregexp, #terminal?, #to_re, #type?, #unicode_classes?, #unquantified_clone
Constructor Details
#initialize(token, options = {}) ⇒ CharacterSet
Returns a new instance of CharacterSet.
9 10 11 12 13 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 9 def initialize(token, = {}) self.negative = false self.closed = false super end |
Instance Attribute Details
#closed ⇒ Object Also known as: closed?
Returns the value of attribute closed.
3 4 5 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 3 def closed @closed end |
#negative ⇒ Object Also known as: negative?, negated?
Returns the value of attribute negative.
3 4 5 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 3 def negative @negative end |
Instance Method Details
#close ⇒ Object
19 20 21 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 19 def close self.closed = true end |
#negate ⇒ Object
15 16 17 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 15 def negate self.negative = true end |
#to_s(format = :full) ⇒ Object
23 24 25 |
# File 'lib/regexp_parser/expression/classes/character_set.rb', line 23 def to_s(format = :full) "#{text}#{'^' if negated?}#{expressions.join}]#{quantifier_affix(format)}" end |