class InvaderZim::Character
Attributes
affiliation[RW]
appearance[RW]
debut[RW]
facts_of_doom[RW]
gender[RW]
homeworld[RW]
introduction[RW]
name[RW]
profile_url[RW]
Public Class Methods
all()
click to toggle source
# File lib/invader_zim/character.rb, line 33 def self.all @@all end
create_from_collection(characters_array)
click to toggle source
# File lib/invader_zim/character.rb, line 16 def self.create_from_collection(characters_array) characters_array.each {|character| InvaderZim::Character.new(character)} end
find(id)
click to toggle source
# File lib/invader_zim/character.rb, line 29 def self.find(id) self.all[id-1] end
make_characters()
click to toggle source
# File lib/invader_zim/character.rb, line 11 def self.make_characters characters_array = InvaderZim::Scraper.scrape_index_page('index.html') self.create_from_collection(characters_array) end
new(character_hash)
click to toggle source
# File lib/invader_zim/character.rb, line 6 def initialize(character_hash) character_hash.each {|k, v| self.send("#{k}=", v)} @@all << self end
Public Instance Methods
add_attributes_to_characters(character)
click to toggle source
# File lib/invader_zim/character.rb, line 24 def add_attributes_to_characters(character) attributes = InvaderZim::Scraper.scrape_profile_page(character) character.add_character_attributes(attributes) end
add_character_attributes(attributes_hash)
click to toggle source
# File lib/invader_zim/character.rb, line 20 def add_character_attributes(attributes_hash) attributes_hash.each {|k, v| self.send("#{k}=", v)} end