class ScrapeGot::Houses
Attributes
coat[RW]
name[RW]
region[RW]
words[RW]
Public Class Methods
all_houses()
click to toggle source
# File lib/scrape_got/houses.rb, line 7 def self.all_houses @@all_houses ||= self.load_houses end
load_houses()
click to toggle source
# File lib/scrape_got/houses.rb, line 11 def self.load_houses API.get_houses.collect do |houses_hash| Houses.new(houses_hash) end end
new(attributes = {})
click to toggle source
# File lib/scrape_got/houses.rb, line 17 def initialize(attributes = {}) @name = attributes["name"] @coat = attributes["coatOfArms"] @region = attributes["region"] @words = attributes["words"] end
print_houses()
click to toggle source
# File lib/scrape_got/houses.rb, line 24 def self.print_houses Houses.all_houses.each.with_index(1) do |house, index| puts "#{index} #{house.name}: #{house.words}" puts "Coat of Arms: #{house.coat}" puts "Region: #{house.region}" puts "-----------------------------------".colorize(:light_yellow) end end