Class: Org::StringScanner

Inherits:
StringScanner
  • Object
show all
Defined in:
lib/org/stringscanner.rb

Overview

Adding some comfort

Instance Method Summary collapse

Instance Method Details

#capturesObject

Equivalent to Regexp#captures, returns Array of all matches



7
8
9
10
11
12
13
14
# File 'lib/org/stringscanner.rb', line 7

def captures
  n = 0
  found = []
  while n += 1
    return found unless element = self[n]
    found << element
  end
end