class AllSuperheroes

Constants

SITE

Attributes

name[RW]
url[RW]

Public Class Methods

all() click to toggle source
# File lib/marvel_best_superheroes/allSuperheroes.rb, line 29
def self.all
    @@all
end
create_all_superheroes() click to toggle source
# File lib/marvel_best_superheroes/allSuperheroes.rb, line 21
def self.create_all_superheroes
    Nokogiri::HTML(open(SITE)).css("ul.editorial").css("li").map do |hero|
        name = hero.css("h3").text
        url = hero.css("a").attribute("href").value
        self.new(name, url)
    end
end
new(name = nil, url = nil) click to toggle source
# File lib/marvel_best_superheroes/allSuperheroes.rb, line 14
def initialize(name = nil, url = nil)
    @name = name
    @url = url
    @@all << self
end