Class: MatchData
- Inherits:
-
Object
- Object
- MatchData
- Defined in:
- lib/twitter-text/extractor.rb
Overview
Helper functions to return code point offsets instead of byte offsets.
Instance Method Summary collapse
Instance Method Details
#char_begin(n) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/twitter-text/extractor.rb', line 34 def char_begin(n) if string.respond_to? :codepoints self.begin(n) else string[0, self.begin(n)].codepoint_length end end |
#char_end(n) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/twitter-text/extractor.rb', line 42 def char_end(n) if string.respond_to? :codepoints self.end(n) else string[0, self.end(n)].codepoint_length end end |