Module: PlayWhe::Parser

Defined in:
lib/playwhe/parser.rb

Constant Summary collapse

PATTERN =
/Draw #: <\/strong>(?<draw>\d+).*?Date: <\/strong>(?<day>\d{1,2})-(?<month>[A-Z]{3})-(?<year>\d{2}).*?Mark Drawn: <\/strong>(?<mark>\d+).*?Drawn at: <\/strong>(?<period>[A-Z]{2})/i

Class Method Summary collapse

Class Method Details

.parse(html_results) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/playwhe/parser.rb', line 5

def self.parse(html_results)
  html_results.to_enum(:scan, PATTERN).map do
    m = $~
    date = "#{m[:day]}-#{m[:month]}-#{m[:year]}"

    Result.new \
      draw: m[:draw], date: date, mark: m[:mark], period: m[:period]
  end
end