class Move
Attributes
accuracy[RW]
data[RW]
effect[RW]
id[RW]
name[RW]
pokemon_with_move[RW]
power[RW]
pp[RW]
type[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 19 def self.all @@all end
limit()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 27 def self.limit @@limit end
new(name, url)
click to toggle source
# File lib/dexter_plusplus/move.rb, line 10 def initialize(name, url) self.name = name self.url = url self.data = JSON.parse(RestClient.get(url)) self.set_attributes self.pokemon_with_move = [] @@all << self end
print_all()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 108 def self.print_all self.all.each{|move| move.print_all } end
tag()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 23 def self.tag @@tag end
Public Instance Methods
add_pokemon(pokemon)
click to toggle source
# File lib/dexter_plusplus/move.rb, line 64 def add_pokemon(pokemon) self.pokemon_with_move << pokemon end
get_colored_name()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 88 def get_colored_name self.name.capitalize.light_red end
print_all()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 68 def print_all puts "---------------------------------------------------------" puts " Dexter++ : Move ".light_red puts "---------------------------------------------------------" puts "Name: #{self.print_name}" puts "" self.print_type puts "" self.print_effect puts "" self.print_power puts "" self.print_pp puts "---------------------------------------------------------" end
print_effect()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 96 def print_effect puts "\tEffect: #{self.effect}" end
print_name()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 84 def print_name self.name.capitalize.light_red end
print_power()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 100 def print_power puts "\tPower: #{self.power}" end
print_pp()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 104 def print_pp puts "\tPP: #{self.pp}" end
print_type()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 92 def print_type puts "\tType: #{self.type.print_name(type.name)}" end
set_accuracy()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 44 def set_accuracy self.accuracy = self.data["accuracy"] end
set_attributes()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 31 def set_attributes self.set_accuracy self.set_type self.set_effect self.set_power self.set_pp self.set_id end
set_effect()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 48 def set_effect self.effect = self.data["effect_entries"][0]["effect"] end
set_id()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 60 def set_id self.id = self.data["id"] end
set_power()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 52 def set_power self.power = self.data["power"] end
set_pp()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 56 def set_pp self.pp = self.data["pp"] end
set_type()
click to toggle source
# File lib/dexter_plusplus/move.rb, line 40 def set_type self.type = Type.find_or_create_by_name(self.data["type"]["name"]) end