Module: RegexpPropertyValues::Extension
- Defined in:
- lib/regexp_property_values/extension.rb
Instance Method Summary collapse
- #matched_characters ⇒ Object
-
#matched_codepoints ⇒ Object
Ruby fallback - this stuff is slow as hell, and it wont get much faster.
- #matched_ranges ⇒ Object
- #regexp ⇒ Object
- #supported_by_current_ruby? ⇒ Boolean
Instance Method Details
#matched_characters ⇒ Object
24 25 26 |
# File 'lib/regexp_property_values/extension.rb', line 24 def matched_characters matched_codepoints.map { |cp| cp.chr('utf-8') } end |
#matched_codepoints ⇒ Object
Ruby fallback - this stuff is slow as hell, and it wont get much faster
16 17 18 |
# File 'lib/regexp_property_values/extension.rb', line 16 def matched_codepoints matched_ranges.flat_map(&:to_a) end |
#matched_ranges ⇒ Object
20 21 22 |
# File 'lib/regexp_property_values/extension.rb', line 20 def matched_ranges OnigRegexpPropertyHelper.matched_ranges(self) end |
#regexp ⇒ Object
9 10 11 |
# File 'lib/regexp_property_values/extension.rb', line 9 def regexp @regexp ||= /\p{#{self}}/u end |
#supported_by_current_ruby? ⇒ Boolean
3 4 5 6 7 |
# File 'lib/regexp_property_values/extension.rb', line 3 def supported_by_current_ruby? !!regexp rescue RegexpError, SyntaxError false end |