class MatchData

Helper functions to return code point offsets instead of byte offsets.

Public Instance Methods

char_begin(n) click to toggle source
# 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) click to toggle source
# 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