{"action":"created","comment":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/34050945","id":34050945,"diff_hunk":"@@ -0,0 +1,117 @@\n+class Rolodex\n+  def initialize(headers, entity)\n+    extend Hirb::Console\n+    @options = []\n+    @headers = headers\n+    @entity = entity\n+    create_header_methods\n+  end\n+\n+  def query(data_set, conditions)\n+    query_data_set = data_set.dup\n+    parse_conditions(conditions).each do |condition|\n+      query_data_set = check_conditions(condition, query_data_set)\n+    end\n+    query_data_set\n+  end\n+\n+  def check_conditions(condition, data)\n+    data = process_condition_array(condition, data) if condition.class == Array\n+    data = process_condition_hash(condition, data) if condition.class == Hash\n+    data\n+  end\n+\n+  def process_condition_array(condition, data)\n+    condition.each do |term|\n+      data = @entity.send term, data if term.class == Symbol\n+      data = search_data_text(data, term) unless term.class == Symbol\n+    end\n+    data\n+  end\n+\n+  def process_condition_hash(condition, data)\n+    condition.each do |key, value|\n+      data = method(\"query_#{key}\").call(data, value)\n+    end\n+    data\n+  end\n+\n+  def show_details(data_set, *values)\n+    data_set.select { |_key, value| values.include?(value) }\n+  end\n+\n+  private\n+\n+  def parse_conditions(conditions)\n+    conditions.split(',').each_with_index do |condition, index|\n+      valid_text = text_condition(condition, index)\n+      valid_qualifier = qualifier_condition(condition, index) unless valid_text\n+      column_condition(condition, index) unless valid_text || valid_qualifier\n+    end\n+    @options\n+  end\n+\n+  def text_condition(condition, index)","path":"dino_catalog/rolodex.rb","position":54,"original_position":54,"commit_id":"5b0cf4100aedb64b2291f168d16d413c473e2815","original_commit_id":"5b0cf4100aedb64b2291f168d16d413c473e2815","user":{"login":"jmtai","id":1752795,"avatar_url":"https://avatars.githubusercontent.com/u/1752795?v=3","gravatar_id":"","url":"https://api.github.com/users/jmtai","html_url":"https://github.com/jmtai","followers_url":"https://api.github.com/users/jmtai/followers","following_url":"https://api.github.com/users/jmtai/following{/other_user}","gists_url":"https://api.github.com/users/jmtai/gists{/gist_id}","starred_url":"https://api.github.com/users/jmtai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmtai/subscriptions","organizations_url":"https://api.github.com/users/jmtai/orgs","repos_url":"https://api.github.com/users/jmtai/repos","events_url":"https://api.github.com/users/jmtai/events{/privacy}","received_events_url":"https://api.github.com/users/jmtai/received_events","type":"User","site_admin":false},"body":"These are a bit confusing because you're returning `true/false` but the method itself has side effects (i.e. it's modifying the options variable via `add_to_conditions`).\r\n\r\nConsider refactoring these into a predicate method and a modifier method to make the methods single responsibility.","created_at":"2015-07-07T15:12:29Z","updated_at":"2015-07-07T15:12:29Z","html_url":"https://github.com/jmmastey/level_up_exercises/pull/774#discussion_r34050945","pull_request_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774","_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/34050945"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/774#discussion_r34050945"},"pull_request":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774"}}},"pull_request":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774","id":39199875,"html_url":"https://github.com/jmmastey/level_up_exercises/pull/774","diff_url":"https://github.com/jmmastey/level_up_exercises/pull/774.diff","patch_url":"https://github.com/jmmastey/level_up_exercises/pull/774.patch","issue_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/774","number":774,"state":"open","locked":false,"title":"Dino Catalog jnyman","user":{"login":"jnyman","id":890903,"avatar_url":"https://avatars.githubusercontent.com/u/890903?v=3","gravatar_id":"","url":"https://api.github.com/users/jnyman","html_url":"https://github.com/jnyman","followers_url":"https://api.github.com/users/jnyman/followers","following_url":"https://api.github.com/users/jnyman/following{/other_user}","gists_url":"https://api.github.com/users/jnyman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnyman/subscriptions","organizations_url":"https://api.github.com/users/jnyman/orgs","repos_url":"https://api.github.com/users/jnyman/repos","events_url":"https://api.github.com/users/jnyman/events{/privacy}","received_events_url":"https://api.github.com/users/jnyman/received_events","type":"User","site_admin":false},"body":"For this application, I ended up using Hirb, which I found through some Rails discussions where it was mentioned that Hirb can do nice things for console output. For me, this gem helped format the table information from the CSV files in a nice way.\r\n\r\nMy goal was to keep certain functionality as separate as possible. For example, the Rolodex and the Importer could technically be used with any sort of business entity. It just happens that with DinoDex, that the entity is a Dinosaur.\r\n\r\nThere are some things I could do to make the application more robust. Rethinking some aspects of the CLI interface would be front and center. Also the interface is not as case-insensitive as I would like. I'm willing to work on these things, as well as the extra credit, but this exercise is already taking way too long (on my part) so I want to make sure to get something out there and get some comments on it.","created_at":"2015-07-04T00:03:25Z","updated_at":"2015-07-07T15:12:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59e1232f80610e5e3a539880575714a4fabe9e6a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774/commits","review_comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774/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/774/comments","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/5b0cf4100aedb64b2291f168d16d413c473e2815","head":{"label":"jnyman:dino_catalog_jnyman","ref":"dino_catalog_jnyman","sha":"5b0cf4100aedb64b2291f168d16d413c473e2815","user":{"login":"jnyman","id":890903,"avatar_url":"https://avatars.githubusercontent.com/u/890903?v=3","gravatar_id":"","url":"https://api.github.com/users/jnyman","html_url":"https://github.com/jnyman","followers_url":"https://api.github.com/users/jnyman/followers","following_url":"https://api.github.com/users/jnyman/following{/other_user}","gists_url":"https://api.github.com/users/jnyman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnyman/subscriptions","organizations_url":"https://api.github.com/users/jnyman/orgs","repos_url":"https://api.github.com/users/jnyman/repos","events_url":"https://api.github.com/users/jnyman/events{/privacy}","received_events_url":"https://api.github.com/users/jnyman/received_events","type":"User","site_admin":false},"repo":{"id":37990907,"name":"level_up_exercises","full_name":"jnyman/level_up_exercises","owner":{"login":"jnyman","id":890903,"avatar_url":"https://avatars.githubusercontent.com/u/890903?v=3","gravatar_id":"","url":"https://api.github.com/users/jnyman","html_url":"https://github.com/jnyman","followers_url":"https://api.github.com/users/jnyman/followers","following_url":"https://api.github.com/users/jnyman/following{/other_user}","gists_url":"https://api.github.com/users/jnyman/gists{/gist_id}","starred_url":"https://api.github.com/users/jnyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnyman/subscriptions","organizations_url":"https://api.github.com/users/jnyman/orgs","repos_url":"https://api.github.com/users/jnyman/repos","events_url":"https://api.github.com/users/jnyman/events{/privacy}","received_events_url":"https://api.github.com/users/jnyman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jnyman/level_up_exercises","description":"A series of code-related assignments to challenge starting engineers","fork":true,"url":"https://api.github.com/repos/jnyman/level_up_exercises","forks_url":"https://api.github.com/repos/jnyman/level_up_exercises/forks","keys_url":"https://api.github.com/repos/jnyman/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jnyman/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jnyman/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/jnyman/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/jnyman/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/jnyman/level_up_exercises/events","assignees_url":"https://api.github.com/repos/jnyman/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/jnyman/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/jnyman/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/jnyman/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jnyman/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jnyman/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/jnyman/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jnyman/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/jnyman/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/jnyman/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/jnyman/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/jnyman/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/jnyman/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/jnyman/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/jnyman/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/jnyman/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/jnyman/level_up_exercises/issues/comments{/number}","contents_url":"https://api.github.com/repos/jnyman/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/jnyman/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jnyman/level_up_exercises/merges","archive_url":"https://api.github.com/repos/jnyman/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jnyman/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/jnyman/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/jnyman/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/jnyman/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/jnyman/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jnyman/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/jnyman/level_up_exercises/releases{/id}","created_at":"2015-06-24T14:50:19Z","updated_at":"2015-06-24T14:50:19Z","pushed_at":"2015-07-07T00:25:18Z","git_url":"git://github.com/jnyman/level_up_exercises.git","ssh_url":"git@github.com:jnyman/level_up_exercises.git","clone_url":"https://github.com/jnyman/level_up_exercises.git","svn_url":"https://github.com/jnyman/level_up_exercises","homepage":"http://leveluprails.herokuapp.com","size":334,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"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":"057b4969214f82f6a79748501b269e1dc296f49b","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=3","gravatar_id":"","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=3","gravatar_id":"","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 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":"2015-06-08T20:58:20Z","pushed_at":"2015-07-07T14:17:35Z","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":"http://leveluprails.herokuapp.com","size":152810,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":11,"forks":117,"open_issues":11,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/774"},"issue":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/774"},"comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/774/comments"},"review_comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/774/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/774/commits"},"statuses":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/5b0cf4100aedb64b2291f168d16d413c473e2815"}}}}