Class: Deckstrings::Hero

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

Overview

A Hearthstone hero with basic metadata.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, hero_class) ⇒ Hero

Returns a new instance of Hero

Raises:

  • (ArgumentError)

90
91
92
93
94
95
# File 'lib/deckstrings/deckstrings.rb', line 90

def initialize(id, name, hero_class)
  @id = id
  @name = name
  @hero_class = HeroClass.parse(hero_class)
  raise ArgumentError, "Invalid hero class: #{hero_class}." if @hero_class.nil?
end

Instance Attribute Details

#hero_classHeroClass (readonly)


242
243
244
# File 'lib/deckstrings/deckstrings.rb', line 242

def hero_class
  @hero_class
end

#idInteger (readonly)

Returns Hearthstone DBF ID of the hero.

See Also:


236
237
238
# File 'lib/deckstrings/deckstrings.rb', line 236

def id
  @id
end

#nameString (readonly)


239
240
241
# File 'lib/deckstrings/deckstrings.rb', line 239

def name
  @name
end

Class Method Details

.alleriaHero


178
179
180
# File 'lib/deckstrings/deckstrings.rb', line 178

def self.alleria
  self.from_id(2826)
end

.anduinHero


158
159
160
# File 'lib/deckstrings/deckstrings.rb', line 158

def self.anduin
  self.from_id(813)
end

.arthasHero


208
209
210
# File 'lib/deckstrings/deckstrings.rb', line 208

def self.arthas
  self.from_id(46116)
end

.druidHero


128
129
130
# File 'lib/deckstrings/deckstrings.rb', line 128

def self.druid
  self.malfurion
end

.from_id(id) ⇒ Hero


229
230
231
232
# File 'lib/deckstrings/deckstrings.rb', line 229

def self.from_id(id)
  hero = Database.instance.heroes[id]
  Hero.new(id, hero['name'], hero['class'])
end

.garroshHero


218
219
220
# File 'lib/deckstrings/deckstrings.rb', line 218

def self.garrosh
  self.from_id(7)
end

.guldanHero


188
189
190
# File 'lib/deckstrings/deckstrings.rb', line 188

def self.guldan
  self.from_id(893)
end

.hunterHero


168
169
170
# File 'lib/deckstrings/deckstrings.rb', line 168

def self.hunter
  self.rexxar
end

.jainaHero


103
104
105
# File 'lib/deckstrings/deckstrings.rb', line 103

def self.jaina
  self.from_id(637)
end

.khadgarHero


108
109
110
# File 'lib/deckstrings/deckstrings.rb', line 108

def self.khadgar
  self.from_id(39117)
end

.liadrinHero


203
204
205
# File 'lib/deckstrings/deckstrings.rb', line 203

def self.liadrin
  self.from_id(2827)
end

.mageHero


98
99
100
# File 'lib/deckstrings/deckstrings.rb', line 98

def self.mage
  self.jaina
end

.magniHero


223
224
225
# File 'lib/deckstrings/deckstrings.rb', line 223

def self.magni
  self.from_id(2828)
end

.maievHero


123
124
125
# File 'lib/deckstrings/deckstrings.rb', line 123

def self.maiev
  self.from_id(40195)
end

.malfurionHero


133
134
135
# File 'lib/deckstrings/deckstrings.rb', line 133

def self.malfurion
  self.from_id(274)
end

.morglHero


148
149
150
# File 'lib/deckstrings/deckstrings.rb', line 148

def self.morgl
  self.from_id(40183)
end

.paladinHero


193
194
195
# File 'lib/deckstrings/deckstrings.rb', line 193

def self.paladin
  self.uther
end

.priestHero


153
154
155
# File 'lib/deckstrings/deckstrings.rb', line 153

def self.priest
  self.anduin
end

.rexxarHero


173
174
175
# File 'lib/deckstrings/deckstrings.rb', line 173

def self.rexxar
  self.from_id(31)
end

.rogueHero


113
114
115
# File 'lib/deckstrings/deckstrings.rb', line 113

def self.rogue
  self.valeera
end

.shamanHero


138
139
140
# File 'lib/deckstrings/deckstrings.rb', line 138

def self.shaman
  self.thrall
end

.thrallHero


143
144
145
# File 'lib/deckstrings/deckstrings.rb', line 143

def self.thrall
  self.from_id(1066)
end

.tyrandeHero


163
164
165
# File 'lib/deckstrings/deckstrings.rb', line 163

def self.tyrande
  self.from_id(41887)
end

.utherHero


198
199
200
# File 'lib/deckstrings/deckstrings.rb', line 198

def self.uther
  self.from_id(671)
end

.valeeraHero


118
119
120
# File 'lib/deckstrings/deckstrings.rb', line 118

def self.valeera
  self.from_id(930)
end

.warlockHero


183
184
185
# File 'lib/deckstrings/deckstrings.rb', line 183

def self.warlock
  self.guldan
end

.warriorHero


213
214
215
# File 'lib/deckstrings/deckstrings.rb', line 213

def self.warrior
  self.garrosh
end