Sha256: 78830522810ec5a4f4ad23da493607262613f874e4d6d87f04eead0d147abe36

Contents?: true

Size: 547 Bytes

Versions: 14

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

require_relative './Print'
require_relative './Main_menu'

class Search
  def self.by_name(data)
    search_prompt = TTY::Prompt.new(active_color: :red)
    poke_array = []
    data.each do |hash|
      hash.each do |k, v|
        poke_array << v if k == :name
      end
    end
    search_prompt.select('Please enter the name of the Pokemon you\'re looking for.', poke_array, filter: true)
  end

  def self.return_hash(data, name)
    data.each do |hash|
      return hash if hash[:name] == name
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pokedex-terminal-0.2.8 lib/classes/Search.rb
pokedex-terminal-0.2.7 lib/classes/Search.rb
pokedex-terminal-0.2.6 lib/classes/Search.rb
pokedex-terminal-0.2.5 lib/classes/Search.rb
pokedex-terminal-0.2.4 lib/classes/Search.rb
pokedex-terminal-0.2.3 lib/classes/Search.rb
pokedex-terminal-0.2.2 lib/classes/Search.rb
pokedex-terminal-0.2.1 lib/classes/Search.rb
pokedex-terminal-0.1.9 lib/classes/Search.rb
pokedex-terminal-0.1.8 lib/classes/Search.rb
pokedex-terminal-0.1.7 lib/classes/Search.rb
pokedex-terminal-0.1.6 lib/classes/Search.rb
pokedex-terminal-0.1.5 lib/classes/Search.rb
pokedex-terminal-0.1.4 lib/classes/Search.rb