Class: PokeAPI::Parser::Type
- Inherits:
-
Object
- Object
- PokeAPI::Parser::Type
- Defined in:
- lib/pokeapi/parser/type.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Type
constructor
A new instance of Type.
- #parse ⇒ Object
Constructor Details
#initialize(data) ⇒ Type
Returns a new instance of Type.
8 9 10 11 |
# File 'lib/pokeapi/parser/type.rb', line 8 def initialize(data) @data = data.clone @damage_relations = @data.delete :damage_relations end |
Class Method Details
.parse(data) ⇒ Object
4 5 6 |
# File 'lib/pokeapi/parser/type.rb', line 4 def self.parse(data) new(data).parse end |
Instance Method Details
#parse ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/pokeapi/parser/type.rb', line 13 def parse { id: @data[:id], name: @data[:name], damage_relations: damage_relations } end |