Sha256: c29452e329ae77ca4c7fed84a87b190ab288a32934fd494c886bd2bc4751534b

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

module PlayWhe
  module Parser
    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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playwhe-0.2.0 lib/playwhe/parser.rb