Class: PokeAPI::Parser::EvolutionChain

Inherits:
Object
  • Object
show all
Defined in:
lib/pokeapi/parser/evolution_chain.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ EvolutionChain

Returns a new instance of EvolutionChain.



8
9
10
11
# File 'lib/pokeapi/parser/evolution_chain.rb', line 8

def initialize(data)
  @data = data.clone
  @chain = data.delete :chain
end

Class Method Details

.parse(data) ⇒ Object



4
5
6
# File 'lib/pokeapi/parser/evolution_chain.rb', line 4

def self.parse(data)
  new(data).parse
end

Instance Method Details

#parseObject



13
14
15
16
17
18
# File 'lib/pokeapi/parser/evolution_chain.rb', line 13

def parse
  {
    id: @data[:id],
    chain: parse_chain(@chain),
  }
end