GitHub PullRequestReviewCommentEvent at 2014-09-09 00:43:19
Repository: level_up_exercises
Actor: jmmastey
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/17276604","id":17276604,"diff_hunk":"@@ -0,0 +1,138 @@\n+#!/usr/bin/env ruby\n+# File dinodex.rb\n+\n+require 'csv'\n+require 'hirb'\n+require './csv_converters'\n+require './dinosaur'\n+require './search_catalog'\n+# DinoDex Super Awesome Fun Time Main Class\n+class Dinodex\n+  attr_accessor :catalog, :search_klass\n+  AVAILABLE_COMMANDS = <<AVAILABLE_COMMANDS\n+Available Commands: search | info | exit\n+----------------------------------------\n+list:\tTo display a list of dinosaurs in\n+        catalog\n+search:\tTo search through the catalog\n+info:\tDisplays all entries, and allows\n+        you to select any entry number\n+        for more information\n+exit:\tTo exit the application\n+----------------------------------------\n+AVAILABLE_COMMANDS\n+\n+  def initialize(config = {}, search = nil)\n+    extend Hirb::Console\n+    self.catalog = {}\n+    self.search_klass = search\n+    options = { path: config[:path] || '*.csv',\n+                headers: true,\n+                header_converters: config[:header_converters] || [],\n+                converters: config[:converters] || []\n+    }\n+    process_csv(options)\n+  end\n+\n+  def show_app_title\n+    '*' * 20 + ' DinoSearch - 5000 ' + '*' * 20\n+  end\n+\n+  def exit_app\n+    show_app_title + \"\\nThanks for stopping by\\n\"\n+  end\n+\n+  def info\n+    get_info(menu catalog.values, fields: Dinosaur.fields, two_d: false,\n+                  action: false, action_object: self)\n+  end\n+\n+  def list\n+    table catalog.values, fields: Dinosaur.fields\n+  end\n+\n+  def search\n+    input = '--help'\n+    while input != 'exit'\n+      puts search_klass.search_help if input == '--help'\n+      print 'Query: '\n+      input = gets.chomp\n+      results = search_klass.search(catalog, input)\n+      query_result(results)\n+    end\n+  end\n+\n+  def query_result(results)\n+    if results.nil?\n+      puts 'No results found. Please try again.'\n+    else\n+      table results.values, fields: Dinosaur.fields\n+    end\n+  end\n+\n+  private\n+\n+  def process_csv(options = {})\n+    file_path = options.delete(:path)\n+    Dir.glob(file_path).each do |file|\n+      create_dinosaurs(CSV.read(file, options))\n+    end\n+  end\n+\n+  def create_dinosaurs(initial_table)\n+    initial_table.by_row.each do |dino|","path":"dino_catalog/dinodex.rb","position":83,"original_position":83,"commit_id":"031a9884322523e82042a2e36cb3d70803959bc1","original_commit_id":"031a9884322523e82042a2e36cb3d70803959bc1","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=2","gravatar_id":"a9704266587836f7e784235e5073b93e","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"body":"Yes. With CSV option `headers: true`, you can just use `row.to_h`.","created_at":"2014-09-09T00:43:19Z","updated_at":"2014-09-09T00:43:19Z","html_url":"https://github.com/jmmastey/level_up_exercises/pull/30#discussion_r17276604","pull_request_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/17276604"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/30#discussion_r17276604"},"pull_request":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30","id":20904391,"html_url":"https://github.com/jmmastey/level_up_exercises/pull/30","diff_url":"https://github.com/jmmastey/level_up_exercises/pull/30.diff","patch_url":"https://github.com/jmmastey/level_up_exercises/pull/30.patch","issue_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/30","number":30,"state":"open","locked":false,"title":"DinoDex 9/8/2014","user":{"login":"enovajuan","id":8239993,"avatar_url":"https://avatars.githubusercontent.com/u/8239993?v=2","gravatar_id":"418f9c7d7e9626d6da943953a905301e","url":"https://api.github.com/users/enovajuan","html_url":"https://github.com/enovajuan","followers_url":"https://api.github.com/users/enovajuan/followers","following_url":"https://api.github.com/users/enovajuan/following{/other_user}","gists_url":"https://api.github.com/users/enovajuan/gists{/gist_id}","starred_url":"https://api.github.com/users/enovajuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enovajuan/subscriptions","organizations_url":"https://api.github.com/users/enovajuan/orgs","repos_url":"https://api.github.com/users/enovajuan/repos","events_url":"https://api.github.com/users/enovajuan/events{/privacy}","received_events_url":"https://api.github.com/users/enovajuan/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-09-08T17:29:12Z","updated_at":"2014-09-09T00:43:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b793f375054c702771f2350aa2d8f929b374ef6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30/commits","review_comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30/comments","review_comment_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/30/comments","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/031a9884322523e82042a2e36cb3d70803959bc1","head":{"label":"enovajuan:dino","ref":"dino","sha":"031a9884322523e82042a2e36cb3d70803959bc1","user":{"login":"enovajuan","id":8239993,"avatar_url":"https://avatars.githubusercontent.com/u/8239993?v=2","gravatar_id":"418f9c7d7e9626d6da943953a905301e","url":"https://api.github.com/users/enovajuan","html_url":"https://github.com/enovajuan","followers_url":"https://api.github.com/users/enovajuan/followers","following_url":"https://api.github.com/users/enovajuan/following{/other_user}","gists_url":"https://api.github.com/users/enovajuan/gists{/gist_id}","starred_url":"https://api.github.com/users/enovajuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enovajuan/subscriptions","organizations_url":"https://api.github.com/users/enovajuan/orgs","repos_url":"https://api.github.com/users/enovajuan/repos","events_url":"https://api.github.com/users/enovajuan/events{/privacy}","received_events_url":"https://api.github.com/users/enovajuan/received_events","type":"User","site_admin":false},"repo":{"id":22175050,"name":"level_up_exercises","full_name":"enovajuan/level_up_exercises","owner":{"login":"enovajuan","id":8239993,"avatar_url":"https://avatars.githubusercontent.com/u/8239993?v=2","gravatar_id":"418f9c7d7e9626d6da943953a905301e","url":"https://api.github.com/users/enovajuan","html_url":"https://github.com/enovajuan","followers_url":"https://api.github.com/users/enovajuan/followers","following_url":"https://api.github.com/users/enovajuan/following{/other_user}","gists_url":"https://api.github.com/users/enovajuan/gists{/gist_id}","starred_url":"https://api.github.com/users/enovajuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enovajuan/subscriptions","organizations_url":"https://api.github.com/users/enovajuan/orgs","repos_url":"https://api.github.com/users/enovajuan/repos","events_url":"https://api.github.com/users/enovajuan/events{/privacy}","received_events_url":"https://api.github.com/users/enovajuan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/enovajuan/level_up_exercises","description":"A long series of code-related assignments to challenge starting engineers","fork":true,"url":"https://api.github.com/repos/enovajuan/level_up_exercises","forks_url":"https://api.github.com/repos/enovajuan/level_up_exercises/forks","keys_url":"https://api.github.com/repos/enovajuan/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enovajuan/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enovajuan/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/enovajuan/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/enovajuan/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/enovajuan/level_up_exercises/events","assignees_url":"https://api.github.com/repos/enovajuan/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/enovajuan/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/enovajuan/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/enovajuan/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enovajuan/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enovajuan/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/enovajuan/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enovajuan/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/enovajuan/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/enovajuan/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/enovajuan/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/enovajuan/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/enovajuan/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/enovajuan/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/enovajuan/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/enovajuan/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/enovajuan/level_up_exercises/issues/comments/{number}","contents_url":"https://api.github.com/repos/enovajuan/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/enovajuan/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enovajuan/level_up_exercises/merges","archive_url":"https://api.github.com/repos/enovajuan/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enovajuan/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/enovajuan/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/enovajuan/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/enovajuan/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/enovajuan/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enovajuan/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/enovajuan/level_up_exercises/releases{/id}","created_at":"2014-07-23T20:17:56Z","updated_at":"2014-09-05T17:57:19Z","pushed_at":"2014-09-08T17:27:55Z","git_url":"git://github.com/enovajuan/level_up_exercises.git","ssh_url":"git@github.com:enovajuan/level_up_exercises.git","clone_url":"https://github.com/enovajuan/level_up_exercises.git","svn_url":"https://github.com/enovajuan/level_up_exercises","homepage":null,"size":1160,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jmmastey:master","ref":"master","sha":"414233c337d5efe3e0f685c1c5bd79b5a9654920","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=2","gravatar_id":"a9704266587836f7e784235e5073b93e","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"repo":{"id":20705648,"name":"level_up_exercises","full_name":"jmmastey/level_up_exercises","owner":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=2","gravatar_id":"a9704266587836f7e784235e5073b93e","url":"https://api.github.com/users/jmmastey","html_url":"https://github.com/jmmastey","followers_url":"https://api.github.com/users/jmmastey/followers","following_url":"https://api.github.com/users/jmmastey/following{/other_user}","gists_url":"https://api.github.com/users/jmmastey/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmastey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmastey/subscriptions","organizations_url":"https://api.github.com/users/jmmastey/orgs","repos_url":"https://api.github.com/users/jmmastey/repos","events_url":"https://api.github.com/users/jmmastey/events{/privacy}","received_events_url":"https://api.github.com/users/jmmastey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmmastey/level_up_exercises","description":"A long series of code-related assignments to challenge starting engineers","fork":false,"url":"https://api.github.com/repos/jmmastey/level_up_exercises","forks_url":"https://api.github.com/repos/jmmastey/level_up_exercises/forks","keys_url":"https://api.github.com/repos/jmmastey/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmmastey/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmmastey/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/jmmastey/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/jmmastey/level_up_exercises/events","assignees_url":"https://api.github.com/repos/jmmastey/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/jmmastey/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/jmmastey/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/jmmastey/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/jmmastey/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/jmmastey/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/jmmastey/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/jmmastey/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/comments/{number}","contents_url":"https://api.github.com/repos/jmmastey/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/jmmastey/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmmastey/level_up_exercises/merges","archive_url":"https://api.github.com/repos/jmmastey/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmmastey/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/jmmastey/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/jmmastey/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmmastey/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/jmmastey/level_up_exercises/releases{/id}","created_at":"2014-06-10T23:42:24Z","updated_at":"2014-09-02T21:41:48Z","pushed_at":"2014-09-05T16:24:32Z","git_url":"git://github.com/jmmastey/level_up_exercises.git","ssh_url":"git@github.com:jmmastey/level_up_exercises.git","clone_url":"https://github.com/jmmastey/level_up_exercises.git","svn_url":"https://github.com/jmmastey/level_up_exercises","homepage":null,"size":3721,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":21,"mirror_url":null,"open_issues_count":14,"forks":21,"open_issues":14,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/30"},"issue":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/30"},"comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/031a9884322523e82042a2e36cb3d70803959bc1"}}}}