class Ability
Attributes
data[RW]
effect[RW]
id[RW]
name[RW]
pokemon_with_ability[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 18 def self.all @@all end
limit()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 30 def self.limit @@limit end
new(name, url)
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 9 def initialize(name, url) self.name = name self.url = url self.data = JSON.parse(RestClient.get(url)) self.pokemon_with_ability = [] self.set_attributes @@all << self end
print_all()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 66 def self.print_all @@all.each {|ability| ability.print_all} end
tag()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 22 def self.tag @@tag end
Public Instance Methods
add_pokemon(pokemon)
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 52 def add_pokemon(pokemon) self.pokemon_with_ability << pokemon end
get_colored_name()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 74 def get_colored_name self.name.capitalize.light_blue end
print_all()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 56 def print_all puts "---------------------------------------------------------" puts " Dexter++ : Ability ".light_blue puts "---------------------------------------------------------" self.print_name puts "" self.print_effect puts "---------------------------------------------------------" end
print_effect()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 78 def print_effect puts "Effect: #{self.effect}" end
print_name()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 70 def print_name puts "Name: #{self.name.capitalize.light_blue}" end
set_attributes()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 34 def set_attributes self.set_effect self.set_id end
set_effect()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 39 def set_effect effect_entries = self.data["effect_entries"] effect_entries.each do |entry| if entry["language"]["name"] == "en" self.effect = entry["effect"] end end end
set_id()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 48 def set_id self.id = self.data["id"] end
tag()
click to toggle source
# File lib/dexter_plusplus/ability.rb, line 26 def tag @@tag end