class Hogwarts::Atlas

Attributes

name[RW]
url[RW]

Public Class Methods

all() click to toggle source
# File lib/atlas.rb, line 30
def self.all
    @@all
end
new(name, url) click to toggle source
# File lib/atlas.rb, line 10
def initialize(name, url)
 @name = name
 @url = url
 @@all << self
end
scrape_atlas() click to toggle source
# File lib/atlas.rb, line 16
def self.scrape_atlas
    maps = []
    doc = Nokogiri::HTML(open("https://www.hp-lexicon.org/list/wizarding-atlas/atlas-of-hogwarts/"))
    info = doc.css(".col-md-12 ul li a")
    info.each do |n|
        atlas = {}
        atlas[:name] = n.text
        atlas[:url] = n.attr("href")
        maps << atlas

    end
    maps
end