Class: PlayGOT::House

Inherits:
Object
  • Object
show all
Defined in:
lib/play_GOT/house.rb

Constant Summary collapse

@@all =
[]
@@chosen =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(house_attributes) ⇒ House

Returns a new instance of House.



6
7
8
9
10
11
# File 'lib/play_GOT/house.rb', line 6

def initialize(house_attributes)
  house_attributes.each do |k, v|
    self.send("#{k}=", v)
  end 
  @@all << self 
end

Instance Attribute Details

#ancestral_weaponsObject

Returns the value of attribute ancestral_weapons.



2
3
4
# File 'lib/play_GOT/house.rb', line 2

def ancestral_weapons
  @ancestral_weapons
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/play_GOT/house.rb', line 2

def name
  @name
end

#regionObject

Returns the value of attribute region.



2
3
4
# File 'lib/play_GOT/house.rb', line 2

def region
  @region
end

#titlesObject

Returns the value of attribute titles.



2
3
4
# File 'lib/play_GOT/house.rb', line 2

def titles
  @titles
end

#wordsObject

Returns the value of attribute words.



2
3
4
# File 'lib/play_GOT/house.rb', line 2

def words
  @words
end

Class Method Details

.allObject



14
15
16
# File 'lib/play_GOT/house.rb', line 14

def self.all 
  @@all
end

.find(i) ⇒ Object



26
27
28
# File 'lib/play_GOT/house.rb', line 26

def self.find(i)
  @@chosen = self.all[i - 1]
end

.list_allObject



19
20
21
22
23
# File 'lib/play_GOT/house.rb', line 19

def self.list_all
  self.all.each.with_index(1) do |h, i|
    puts "#{i} - #{h.name}".blue
  end 
end