Class: Smogon::Pokemon
- Inherits:
-
Object
- Object
- Smogon::Pokemon
- Defined in:
- lib/smogon/types/pokemon.rb
Instance Attribute Summary collapse
-
#_name ⇒ Object
Returns the value of attribute _name.
-
#abilities ⇒ Object
Returns the value of attribute abilities.
-
#base_stats ⇒ Object
Returns the value of attribute base_stats.
-
#moves ⇒ Object
Returns the value of attribute moves.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tier ⇒ Object
Returns the value of attribute tier.
-
#types ⇒ Object
Returns the value of attribute types.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#_name ⇒ Object
Returns the value of attribute _name.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def _name @_name end |
#abilities ⇒ Object
Returns the value of attribute abilities.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def abilities @abilities end |
#base_stats ⇒ Object
Returns the value of attribute base_stats.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def base_stats @base_stats end |
#moves ⇒ Object
Returns the value of attribute moves.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def moves @moves end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def name @name end |
#tier ⇒ Object
Returns the value of attribute tier.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def tier @tier end |
#types ⇒ Object
Returns the value of attribute types.
22 23 24 |
# File 'lib/smogon/types/pokemon.rb', line 22 def types @types end |
Class Method Details
.id2name(id) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/smogon/types/pokemon.rb', line 32 def self.id2name(id) begin Nokogiri::HTML(open("http://www.marriland.com/pokedex/#{id}")).xpath('//div[@class="overview"]/h2')[0].text rescue nil end end |
Instance Method Details
#to_s ⇒ Object
24 25 26 |
# File 'lib/smogon/types/pokemon.rb', line 24 def to_s "Name: #{@name}\nAbility: #{@abilities.join(', ')}\nType: #{@types.join(?/)}\nTier: #{@tier}\nBase stats: #{@base_stats.join(?/)}\nMoves: #{@moves.join(', ')}" end |