class Type

Public Class Methods

new(id) click to toggle source
# File lib/pokeruby/type.rb, line 5
def initialize id
        @type = self.class.get "#{id}"
        self.class.type_chart[self.name] ||= self
end

Public Instance Methods

create_type(type) click to toggle source
# File lib/pokeruby/type.rb, line 34
def create_type type
        self.class.type_chart[type['name'].capitalize] ||= Type.new type['resource_uri'] 
end
ineffective() click to toggle source
# File lib/pokeruby/type.rb, line 14
def ineffective
        @ineffective ||= @type['ineffective'].collect { |type| create_type ty }
end
name() click to toggle source
# File lib/pokeruby/type.rb, line 10
def name
        @type['name']
end
no_effect() click to toggle source
# File lib/pokeruby/type.rb, line 18
def no_effect
        @no_effect ||= @type['no_effect'].collect { |type| create_type type }
end
resistance() click to toggle source
# File lib/pokeruby/type.rb, line 22
def resistance
        @resistance ||= @type['resistance'].collect { |type| create_type type }
end
super_effective() click to toggle source
# File lib/pokeruby/type.rb, line 26
def super_effective
        @super_effective ||= @type['super_effective'].collect { |type| create_type type }
end
weakness() click to toggle source
# File lib/pokeruby/type.rb, line 30
def weakness
        @weakness ||= @type['weakness'].collect { |type| create_type type }
end