class Lottery::Gamble

Attributes

contest[RW]
numbers[RW]

Public Class Methods

new() click to toggle source
# File lib/lottery/gamble.rb, line 15
def initialize 
  page = Mechanize.new.get( path[:url] ).parser
  @contest = page.at("//p").inner_html.scan(/(?=^)\d+/).first.to_i
  @numbers = page.xpath( path[:dom] )
end

Public Instance Methods

get_contest() click to toggle source
# File lib/lottery/gamble.rb, line 22
def get_contest; @contest; end
get_numbers() click to toggle source
# File lib/lottery/gamble.rb, line 23
def get_numbers; @numbers; end

Private Instance Methods

path() click to toggle source
# File lib/lottery/gamble.rb, line 9
def path
  Hash[ YAML::load( File.read(
    File.join( File.dirname(__dir__), '..', 'config', 'contests.yml' )
  ))[ self.class.to_s.downcase.split(/::/).last ].map{|k,v|[k.to_sym,v]} ]
end