Skip to content

Instantly share code, notes, and snippets.

@redsquirrel
Created July 31, 2012 22:26
Show Gist options
  • Select an option

  • Save redsquirrel/3221208 to your computer and use it in GitHub Desktop.

Select an option

Save redsquirrel/3221208 to your computer and use it in GitHub Desktop.
array.each_with_index do |line, index|
if line.match(/^<s>/i)
start = index
splits = line.scan(/<(?:s|c)>\s*/i).map(&:size)
end
# detect a line that's all dashes and spaces
if line.match(/^[\- ]+$/)
start = index
# scan for dashes followed by a space
splits = line.scan(/\-+ /).map(&:size)
end
if line.match(/^<\/table>/i)
stop = index
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment