Class: MatchData

Inherits:
Object
  • Object
show all
Defined in:
lib/canopus/match_data_compat.rb

Instance Method Summary collapse

Instance Method Details

#bytebegin(index) ⇒ Object



13
# File 'lib/canopus/match_data_compat.rb', line 13

def bytebegin(index) = byteoffset(index)&.first

#byteend(index) ⇒ Object



14
# File 'lib/canopus/match_data_compat.rb', line 14

def byteend(index) = byteoffset(index)&.last

#byteoffset(index) ⇒ Object



6
7
8
9
# File 'lib/canopus/match_data_compat.rb', line 6

def byteoffset(index)
  first, last = offset(index)
  first && [string[0...first].bytesize, string[0...last].bytesize]
end