class Move
Attributes
name[R]
pretty_name[R]
Public Class Methods
all()
click to toggle source
# File lib/move.rb, line 22 def self.all @@all end
find_or_create_by_name(name)
click to toggle source
# File lib/move.rb, line 26 def self.find_or_create_by_name(name) if Scraper.moves.include?(name) return self.all.detect{|a| a.name == name} if self.all.collect{|a| a.name}.include?(name) return Move.new(name) end return nil end
find_or_create_by_pretty_name(pretty_name)
click to toggle source
# File lib/move.rb, line 34 def self.find_or_create_by_pretty_name(pretty_name) self.find_or_create_by_name(pretty_name.split(" ").collect{|word| word.downcase}.join("-")) end
new(name)
click to toggle source
# File lib/move.rb, line 8 def initialize(name) @name = name @pretty_name = name.split("-").collect{|word| word.capitalize}.join(" ") @@all << self end
Public Instance Methods
type()
click to toggle source
# File lib/move.rb, line 15 def type if @type == nil @type = Scraper.get_move_by_name(name)["type"]["name"] end @type end