GitHub PullRequestReviewCommentEvent at 2014-10-01 07:39:06
Repository: level_up_exercises
Actor: bwthomas
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/18264723","id":18264723,"diff_hunk":"@@ -0,0 +1,138 @@\n+require_relative 'respond.rb'\n+\n+class Bomb\n+  INTEGRITY_EXPLODED  = 'Blown to shreds'\n+  INTEGRITY_SNIPPED   = 'Wires are cut'\n+  INTEGRITY_INTACT    = 'Intact'\n+\n+  ACTIVATION_NOT_APPLICABLE  = 'NA'\n+  ACTIVATION_ACTIVE          = 'Active'\n+  ACTIVATION_INACTIVE        = 'Inactive'\n+\n+  DEFAULT_ACTIVATION_CODE = '1234'\n+  DEFAULT_DEACTIVATION_CODE = '0000'\n+\n+  def initialize(respond, activation_code = DEFAULT_ACTIVATION_CODE, deactivation_code = DEFAULT_DEACTIVATION_CODE)\n+    @respond = respond\n+    set_activation_code(activation_code)\n+    set_deactivation_code(deactivation_code)\n+    initialize_state\n+  end\n+\n+  def initialize_state\n+    @active = false\n+    @snipped = false\n+    @deactivation_attempts = 0\n+    @detonated = false\n+  end\n+\n+  def activate(code)\n+    return bomb_is_defunct if bomb_is_defunct\n+    return @respond.with(:already_active) if active?\n+    return @respond.with(:code_not_an_int) unless integer?(code)\n+    attempt_to_activate(code)\n+  end\n+\n+  def deactivate(code)\n+    return bomb_is_defunct if bomb_is_defunct\n+    return @respond.with(:already_inactive) unless active?\n+    return @respond.with(:code_not_an_int) unless integer?(code)\n+    attempt_to_deactivate(code)\n+  end\n+\n+  def snip\n+    return bomb_is_defunct if bomb_is_defunct\n+    @snipped = true\n+    @respond.with(:just_snipped)\n+  end\n+\n+  def detonate\n+    return bomb_is_defunct if bomb_is_defunct\n+    @detonated = true\n+    @respond.with(:detonation)\n+  end\n+\n+  def active?\n+    @active && !exploded? && !snipped?\n+  end\n+\n+  def exploded?\n+    @deactivation_attempts >= 3 || @detonated\n+  end\n+\n+  def snipped?\n+    @snipped\n+  end\n+\n+  def to_h\n+    result = {}\n+    result['integrity'] = integrity_status\n+    result['activation'] = activation_status\n+    result['deact_attempts'] = @deactivation_attempts\n+    result\n+  end\n+\n+  private\n+\n+  def integrity_status\n+    return INTEGRITY_EXPLODED if exploded?\n+    return INTEGRITY_SNIPPED   if snipped?\n+    INTEGRITY_INTACT\n+  end\n+\n+  def activation_status\n+    return ACTIVATION_NOT_APPLICABLE if exploded? || snipped?\n+    return ACTIVATION_ACTIVE if active?\n+    ACTIVATION_INACTIVE\n+  end\n+\n+  def integer?(str)\n+    (str =~ /[0-9]+/)","path":"overlord/bomb.rb","position":90,"original_position":90,"commit_id":"8dece534b1fffcf389597cc47fd2662846441f7d","original_commit_id":"8dece534b1fffcf389597cc47fd2662846441f7d","user":{"login":"bwthomas","id":1060797,"avatar_url":"https://avatars.githubusercontent.com/u/1060797?v=2","gravatar_id":"","url":"https://api.github.com/users/bwthomas","html_url":"https://github.com/bwthomas","followers_url":"https://api.github.com/users/bwthomas/followers","following_url":"https://api.github.com/users/bwthomas/following{/other_user}","gists_url":"https://api.github.com/users/bwthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/bwthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwthomas/subscriptions","organizations_url":"https://api.github.com/users/bwthomas/orgs","repos_url":"https://api.github.com/users/bwthomas/repos","events_url":"https://api.github.com/users/bwthomas/events{/privacy}","received_events_url":"https://api.github.com/users/bwthomas/received_events","type":"User","site_admin":false},"body":"You can also use slashed character classes. For example, in this instance you could do this:\r\n\r\n```\r\n  str =~ /\\d+/\r\n```","created_at":"2014-10-01T07:39:06Z","updated_at":"2014-10-01T07:39:06Z","html_url":"https://github.com/jmmastey/level_up_exercises/pull/96#discussion_r18264723","pull_request_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/comments/18264723"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/96#discussion_r18264723"},"pull_request":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96","id":21862341,"html_url":"https://github.com/jmmastey/level_up_exercises/pull/96","diff_url":"https://github.com/jmmastey/level_up_exercises/pull/96.diff","patch_url":"https://github.com/jmmastey/level_up_exercises/pull/96.patch","issue_url":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/96","number":96,"state":"open","locked":false,"title":"Overlord","user":{"login":"zsyed1","id":8593056,"avatar_url":"https://avatars.githubusercontent.com/u/8593056?v=2","gravatar_id":"","url":"https://api.github.com/users/zsyed1","html_url":"https://github.com/zsyed1","followers_url":"https://api.github.com/users/zsyed1/followers","following_url":"https://api.github.com/users/zsyed1/following{/other_user}","gists_url":"https://api.github.com/users/zsyed1/gists{/gist_id}","starred_url":"https://api.github.com/users/zsyed1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsyed1/subscriptions","organizations_url":"https://api.github.com/users/zsyed1/orgs","repos_url":"https://api.github.com/users/zsyed1/repos","events_url":"https://api.github.com/users/zsyed1/events{/privacy}","received_events_url":"https://api.github.com/users/zsyed1/received_events","type":"User","site_admin":false},"body":"I tried to address all comments and feedback from last code review by Joe.\r\nI installed the selenium-driver for capybara and refactored views to invoke actions directly from javascript.\r\nI separated test features into logical buckets and paid attention to happy/sad/error order.","created_at":"2014-09-26T17:18:42Z","updated_at":"2014-10-01T07:39:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44c1ed5f988de7a20c5af39b97628d3110275910","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96/commits","review_comments_url":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96/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/96/comments","statuses_url":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/8dece534b1fffcf389597cc47fd2662846441f7d","head":{"label":"zsyed1:overlord","ref":"overlord","sha":"8dece534b1fffcf389597cc47fd2662846441f7d","user":{"login":"zsyed1","id":8593056,"avatar_url":"https://avatars.githubusercontent.com/u/8593056?v=2","gravatar_id":"","url":"https://api.github.com/users/zsyed1","html_url":"https://github.com/zsyed1","followers_url":"https://api.github.com/users/zsyed1/followers","following_url":"https://api.github.com/users/zsyed1/following{/other_user}","gists_url":"https://api.github.com/users/zsyed1/gists{/gist_id}","starred_url":"https://api.github.com/users/zsyed1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsyed1/subscriptions","organizations_url":"https://api.github.com/users/zsyed1/orgs","repos_url":"https://api.github.com/users/zsyed1/repos","events_url":"https://api.github.com/users/zsyed1/events{/privacy}","received_events_url":"https://api.github.com/users/zsyed1/received_events","type":"User","site_admin":false},"repo":{"id":24329018,"name":"level_up_exercises","full_name":"zsyed1/level_up_exercises","owner":{"login":"zsyed1","id":8593056,"avatar_url":"https://avatars.githubusercontent.com/u/8593056?v=2","gravatar_id":"","url":"https://api.github.com/users/zsyed1","html_url":"https://github.com/zsyed1","followers_url":"https://api.github.com/users/zsyed1/followers","following_url":"https://api.github.com/users/zsyed1/following{/other_user}","gists_url":"https://api.github.com/users/zsyed1/gists{/gist_id}","starred_url":"https://api.github.com/users/zsyed1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsyed1/subscriptions","organizations_url":"https://api.github.com/users/zsyed1/orgs","repos_url":"https://api.github.com/users/zsyed1/repos","events_url":"https://api.github.com/users/zsyed1/events{/privacy}","received_events_url":"https://api.github.com/users/zsyed1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zsyed1/level_up_exercises","description":"A long series of code-related assignments to challenge starting engineers","fork":true,"url":"https://api.github.com/repos/zsyed1/level_up_exercises","forks_url":"https://api.github.com/repos/zsyed1/level_up_exercises/forks","keys_url":"https://api.github.com/repos/zsyed1/level_up_exercises/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zsyed1/level_up_exercises/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zsyed1/level_up_exercises/teams","hooks_url":"https://api.github.com/repos/zsyed1/level_up_exercises/hooks","issue_events_url":"https://api.github.com/repos/zsyed1/level_up_exercises/issues/events{/number}","events_url":"https://api.github.com/repos/zsyed1/level_up_exercises/events","assignees_url":"https://api.github.com/repos/zsyed1/level_up_exercises/assignees{/user}","branches_url":"https://api.github.com/repos/zsyed1/level_up_exercises/branches{/branch}","tags_url":"https://api.github.com/repos/zsyed1/level_up_exercises/tags","blobs_url":"https://api.github.com/repos/zsyed1/level_up_exercises/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zsyed1/level_up_exercises/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zsyed1/level_up_exercises/git/refs{/sha}","trees_url":"https://api.github.com/repos/zsyed1/level_up_exercises/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zsyed1/level_up_exercises/statuses/{sha}","languages_url":"https://api.github.com/repos/zsyed1/level_up_exercises/languages","stargazers_url":"https://api.github.com/repos/zsyed1/level_up_exercises/stargazers","contributors_url":"https://api.github.com/repos/zsyed1/level_up_exercises/contributors","subscribers_url":"https://api.github.com/repos/zsyed1/level_up_exercises/subscribers","subscription_url":"https://api.github.com/repos/zsyed1/level_up_exercises/subscription","commits_url":"https://api.github.com/repos/zsyed1/level_up_exercises/commits{/sha}","git_commits_url":"https://api.github.com/repos/zsyed1/level_up_exercises/git/commits{/sha}","comments_url":"https://api.github.com/repos/zsyed1/level_up_exercises/comments{/number}","issue_comment_url":"https://api.github.com/repos/zsyed1/level_up_exercises/issues/comments/{number}","contents_url":"https://api.github.com/repos/zsyed1/level_up_exercises/contents/{+path}","compare_url":"https://api.github.com/repos/zsyed1/level_up_exercises/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zsyed1/level_up_exercises/merges","archive_url":"https://api.github.com/repos/zsyed1/level_up_exercises/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zsyed1/level_up_exercises/downloads","issues_url":"https://api.github.com/repos/zsyed1/level_up_exercises/issues{/number}","pulls_url":"https://api.github.com/repos/zsyed1/level_up_exercises/pulls{/number}","milestones_url":"https://api.github.com/repos/zsyed1/level_up_exercises/milestones{/number}","notifications_url":"https://api.github.com/repos/zsyed1/level_up_exercises/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zsyed1/level_up_exercises/labels{/name}","releases_url":"https://api.github.com/repos/zsyed1/level_up_exercises/releases{/id}","created_at":"2014-09-22T13:10:53Z","updated_at":"2014-09-02T21:41:48Z","pushed_at":"2014-09-29T19:40:10Z","git_url":"git://github.com/zsyed1/level_up_exercises.git","ssh_url":"git@github.com:zsyed1/level_up_exercises.git","clone_url":"https://github.com/zsyed1/level_up_exercises.git","svn_url":"https://github.com/zsyed1/level_up_exercises","homepage":null,"size":337,"stargazers_count":0,"watchers_count":0,"language":null,"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":"552accc53ca2c7cc388735353652362c50fb0033","user":{"login":"jmmastey","id":302011,"avatar_url":"https://avatars.githubusercontent.com/u/302011?v=2","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=2","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":"2014-09-25T17:08:09Z","pushed_at":"2014-09-26T18:33:08Z","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":6812,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":15,"forks":29,"open_issues":15,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96"},"html":{"href":"https://github.com/jmmastey/level_up_exercises/pull/96"},"issue":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/96"},"comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/pulls/96/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/96/commits"},"statuses":{"href":"https://api.github.com/repos/jmmastey/level_up_exercises/statuses/8dece534b1fffcf389597cc47fd2662846441f7d"}}}}