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
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
print_effect() click to toggle source
print_name() click to toggle source
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