class StrangerThingsDirectory::Characters
Attributes
actor[RW]
affiliation[RW]
age[RW]
aliases[RW]
born[RW]
family[RW]
gender[RW]
name[RW]
occupation[RW]
residence[RW]
status[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/stranger_things_directory/characters.rb, line 18 def self.all @@all end
find(index)
click to toggle source
# File lib/stranger_things_directory/characters.rb, line 22 def self.find(index) @@all[index -1] end
new(name=nil, url=nil)
click to toggle source
# File lib/stranger_things_directory/characters.rb, line 12 def initialize(name=nil, url=nil) @name = name @url = url @@all << self end
new_character(char)
click to toggle source
# File lib/stranger_things_directory/characters.rb, line 6 def self.new_character(char) self.new( char.css("a figure figcaption.category-page__trending-page-title").text, "https://strangerthings.fandom.com#{char.css("a").attribute("href").text}" ) end
Public Instance Methods
doc()
click to toggle source
# File lib/stranger_things_directory/characters.rb, line 26 def doc @doc ||= Nokogiri::HTML(open(self.url)) end