Top Level Namespace

Constant Summary collapse

PATH =
File.expand_path("../..", __FILE__)
GAMES =
JSON.parse(File.open("#{PATH}/data/allgames.json").read)

Instance Method Summary collapse

Instance Method Details

#find_game(keyword) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vglist.rb', line 8

def find_game(keyword)
  results = {}
  GAMES.map do |platform,games|
    games.map do |game|
      if game.downcase.include?(keyword.downcase)
        results[platform] ? results[platform] << game : results[platform] = [game]
      end
    end
  end
  return results
end