response.rb 335 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. module PKParse
  3. class Response
  4. attr_accessor :response, :pokemon
  5. def initialize(response)
  6. @response = response
  7. build_pokemon
  8. end
  9. private
  10. def build_pokemon
  11. @pokemon = response.map do |pkmn|
  12. PKParse::Pokemon.new(pkmn)
  13. end
  14. end
  15. end
  16. end