Method: Conquest::Parser#initialize

Defined in:
lib/conquest/parser.rb

#initialize(url) ⇒ Parser

Returns a new instance of Parser.



9
10
11
12
13
14
15
# File 'lib/conquest/parser.rb', line 9

def initialize(url)
  # Grab all of the rows from the table containing all of the Pokemon.
  # Drop the first two because they just have header data.
  @pkmn = Nokogiri::HTML(open(url)).css("table.tab > tr").drop(1).map do |p|
    PkmnInfo.new p.children[0].text[1..-1].to_i, p.children[4].text
  end
end