class PokemonTranslator

Public Class Methods

exec(name) click to toggle source
# File lib/pokemon_translator.rb, line 4
def self.exec(name)
  file = File.open("pokemon.json", "r")
  json = JSON.parser.new(file.read)
  file.close
  array = json.parse
  array = array.find { |hash| hash["name"]["japanese"] == name }

  begin
    array["name"]["english"]
  rescue NoMethodError
    "Not Found"
  end
end