Class: Regexp::Expression::EscapeSequence::CodepointList
- Inherits:
-
Base
- Object
- Base
- Base
- Regexp::Expression::EscapeSequence::CodepointList
show all
- Defined in:
- lib/regexp_parser/expression/classes/escape.rb
Instance Attribute Summary
Attributes inherited from Base
#conditional_level, #level, #nesting_level, #options, #quantifier, #set_level, #text, #token, #ts, #type
Instance Method Summary
collapse
Methods inherited from Base
#ascii_classes?, #attributes, #case_insensitive?, #coded_offset, #default_classes?, #free_spacing?, #full_length, #greedy?, #initialize, #initialize_clone, #is?, #match, #matches?, #multiline?, #offset, #one_of?, #possessive?, #quantified?, #quantifier_affix, #quantify, #quantity, #reluctant?, #strfregexp, #terminal?, #to_re, #to_s, #type?, #unicode_classes?
Instance Method Details
#char ⇒ Object
35
36
37
|
# File 'lib/regexp_parser/expression/classes/escape.rb', line 35
def char
raise NoMethodError, 'CodepointList responds only to #chars'
end
|
#chars ⇒ Object
43
44
45
|
# File 'lib/regexp_parser/expression/classes/escape.rb', line 43
def chars
codepoints.map { |cp| cp.chr('utf-8') }
end
|
#codepoint ⇒ Object
39
40
41
|
# File 'lib/regexp_parser/expression/classes/escape.rb', line 39
def codepoint
raise NoMethodError, 'CodepointList responds only to #codepoints'
end
|
#codepoints ⇒ Object
47
48
49
|
# File 'lib/regexp_parser/expression/classes/escape.rb', line 47
def codepoints
text.scan(/\h+/).map(&:hex)
end
|