Class: PokeAPI::Parser::EvolutionChain
- Inherits:
-
Object
- Object
- PokeAPI::Parser::EvolutionChain
- Defined in:
- lib/pokeapi/parser/evolution_chain.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ EvolutionChain
constructor
A new instance of EvolutionChain.
- #parse ⇒ Object
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
#parse ⇒ Object
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 |