Method: Pericope::Parsing#match_all

Defined in:
lib/pericope/parsing.rb

#match_all(text) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/pericope/parsing.rb', line 64

def match_all(text)
  text.scan(Pericope.regexp) do
    match = Regexp.last_match
    book = BOOK_IDS[match.captures.find_index(&:itself)]

    ranges = parse_reference(book, match[67])
    next if ranges.empty?

    attributes = {
      :original_string => match.to_s,
      :book => book,
      :ranges => ranges
    }

    yield attributes, match
  end
end