{"action":"created","comment":{"url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/comments/70117183","id":70117183,"diff_hunk":"@@ -1,36 +1,63 @@\n-def match?(string, substring)\n-  string_array = string.split(\"\")\n-  substring_array = substring.split(\"\")\n-  character_matches = []\n-  substring_array.each_with_index do |substring_character, substring_index|\n-    find_character_match(string_array, substring_array, substring_character, substring_index, character_matches)\n+class String\n+\n+  def match?(substring)\n+    if substring.class == String\n+      #passing hash to collect matches, as well as the starting\n+      #index 0 for the recursive call\n+      matches = generate_matches(self, substring, {}, 0)\n+      matches.has_value?(substring)\n+    else\n+      wrong_argument_type\n+    end\n   end\n-  character_matches.join(\"\") == substring ? true : false\n-end\n \n-def find_character_match(string_array, substring_array, substring_character, substring_index, character_matches)\n-  if string_array.include?(substring_character)\n-    if substring_index == 0\n-      character_matches.push(substring_character)\n-    elsif substring_index > 0\n-      string_array.each_with_index do |string_character, string_index|\n-\n-        characters_do_match = string_character == substring_character\n-        previous_string_index_not_negative = string_index - 1 > -1\n-        previous_characters_do_match = string_array[string_index - 1] == substring_array[substring_index - 1]\n-\n-        if characters_do_match && previous_string_index_not_negative && previous_characters_do_match\n-          character_matches.push(substring_character)\n-          break\n-        end\n-      end\n+  def match_count(substring)\n+    if substring.class == String","path":"string_match_without_scan_or_regex.rb","position":39,"original_position":39,"commit_id":"3f78a692c24dd8a246c214718bd7a4715d6545bc","original_commit_id":"3f78a692c24dd8a246c214718bd7a4715d6545bc","user":{"login":"tschady","id":1934009,"avatar_url":"https://avatars.githubusercontent.com/u/1934009?v=3","gravatar_id":"","url":"https://api.github.com/users/tschady","html_url":"https://github.com/tschady","followers_url":"https://api.github.com/users/tschady/followers","following_url":"https://api.github.com/users/tschady/following{/other_user}","gists_url":"https://api.github.com/users/tschady/gists{/gist_id}","starred_url":"https://api.github.com/users/tschady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschady/subscriptions","organizations_url":"https://api.github.com/users/tschady/orgs","repos_url":"https://api.github.com/users/tschady/repos","events_url":"https://api.github.com/users/tschady/events{/privacy}","received_events_url":"https://api.github.com/users/tschady/received_events","type":"User","site_admin":false},"body":"in a dynamically typed language, you generally don't need to/shouldn't be checking types.  Can you think of a way to write this method to return the appropriate value for several different data types?","created_at":"2016-07-08T18:15:12Z","updated_at":"2016-07-08T18:15:12Z","html_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1#discussion_r70117183","pull_request_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/comments/70117183"},"html":{"href":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1#discussion_r70117183"},"pull_request":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1","id":76774769,"html_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1","diff_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1.diff","patch_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1.patch","issue_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/1","number":1,"state":"open","locked":false,"title":"Recursion","user":{"login":"Durkheim","id":10007476,"avatar_url":"https://avatars.githubusercontent.com/u/10007476?v=3","gravatar_id":"","url":"https://api.github.com/users/Durkheim","html_url":"https://github.com/Durkheim","followers_url":"https://api.github.com/users/Durkheim/followers","following_url":"https://api.github.com/users/Durkheim/following{/other_user}","gists_url":"https://api.github.com/users/Durkheim/gists{/gist_id}","starred_url":"https://api.github.com/users/Durkheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Durkheim/subscriptions","organizations_url":"https://api.github.com/users/Durkheim/orgs","repos_url":"https://api.github.com/users/Durkheim/repos","events_url":"https://api.github.com/users/Durkheim/events{/privacy}","received_events_url":"https://api.github.com/users/Durkheim/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-08T15:56:53Z","updated_at":"2016-07-08T18:15:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"563a85a5e8f7a336eecccf407ad7887cd6b86723","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/1/comments","statuses_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/statuses/3f78a692c24dd8a246c214718bd7a4715d6545bc","head":{"label":"Durkheim:recursion","ref":"recursion","sha":"3f78a692c24dd8a246c214718bd7a4715d6545bc","user":{"login":"Durkheim","id":10007476,"avatar_url":"https://avatars.githubusercontent.com/u/10007476?v=3","gravatar_id":"","url":"https://api.github.com/users/Durkheim","html_url":"https://github.com/Durkheim","followers_url":"https://api.github.com/users/Durkheim/followers","following_url":"https://api.github.com/users/Durkheim/following{/other_user}","gists_url":"https://api.github.com/users/Durkheim/gists{/gist_id}","starred_url":"https://api.github.com/users/Durkheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Durkheim/subscriptions","organizations_url":"https://api.github.com/users/Durkheim/orgs","repos_url":"https://api.github.com/users/Durkheim/repos","events_url":"https://api.github.com/users/Durkheim/events{/privacy}","received_events_url":"https://api.github.com/users/Durkheim/received_events","type":"User","site_admin":false},"repo":{"id":51093147,"name":"String-Matching-Without-Scan-or-Regex","full_name":"Durkheim/String-Matching-Without-Scan-or-Regex","owner":{"login":"Durkheim","id":10007476,"avatar_url":"https://avatars.githubusercontent.com/u/10007476?v=3","gravatar_id":"","url":"https://api.github.com/users/Durkheim","html_url":"https://github.com/Durkheim","followers_url":"https://api.github.com/users/Durkheim/followers","following_url":"https://api.github.com/users/Durkheim/following{/other_user}","gists_url":"https://api.github.com/users/Durkheim/gists{/gist_id}","starred_url":"https://api.github.com/users/Durkheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Durkheim/subscriptions","organizations_url":"https://api.github.com/users/Durkheim/orgs","repos_url":"https://api.github.com/users/Durkheim/repos","events_url":"https://api.github.com/users/Durkheim/events{/privacy}","received_events_url":"https://api.github.com/users/Durkheim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex","description":"","fork":false,"url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex","forks_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/forks","keys_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/teams","hooks_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/hooks","issue_events_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/events{/number}","events_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/events","assignees_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/assignees{/user}","branches_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/branches{/branch}","tags_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/tags","blobs_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/refs{/sha}","trees_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/statuses/{sha}","languages_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/languages","stargazers_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/stargazers","contributors_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/contributors","subscribers_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/subscribers","subscription_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/subscription","commits_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/commits{/sha}","git_commits_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/commits{/sha}","comments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/comments{/number}","issue_comment_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/comments{/number}","contents_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/contents/{+path}","compare_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/merges","archive_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/downloads","issues_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues{/number}","pulls_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls{/number}","milestones_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/milestones{/number}","notifications_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/labels{/name}","releases_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/releases{/id}","deployments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/deployments","created_at":"2016-02-04T17:35:54Z","updated_at":"2016-02-04T17:56:00Z","pushed_at":"2016-07-08T16:25:59Z","git_url":"git://github.com/Durkheim/String-Matching-Without-Scan-or-Regex.git","ssh_url":"git@github.com:Durkheim/String-Matching-Without-Scan-or-Regex.git","clone_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex.git","svn_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex","homepage":null,"size":50,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Durkheim:master","ref":"master","sha":"3570b96482e7821c1b5c8f285b55d13a7ba5965e","user":{"login":"Durkheim","id":10007476,"avatar_url":"https://avatars.githubusercontent.com/u/10007476?v=3","gravatar_id":"","url":"https://api.github.com/users/Durkheim","html_url":"https://github.com/Durkheim","followers_url":"https://api.github.com/users/Durkheim/followers","following_url":"https://api.github.com/users/Durkheim/following{/other_user}","gists_url":"https://api.github.com/users/Durkheim/gists{/gist_id}","starred_url":"https://api.github.com/users/Durkheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Durkheim/subscriptions","organizations_url":"https://api.github.com/users/Durkheim/orgs","repos_url":"https://api.github.com/users/Durkheim/repos","events_url":"https://api.github.com/users/Durkheim/events{/privacy}","received_events_url":"https://api.github.com/users/Durkheim/received_events","type":"User","site_admin":false},"repo":{"id":51093147,"name":"String-Matching-Without-Scan-or-Regex","full_name":"Durkheim/String-Matching-Without-Scan-or-Regex","owner":{"login":"Durkheim","id":10007476,"avatar_url":"https://avatars.githubusercontent.com/u/10007476?v=3","gravatar_id":"","url":"https://api.github.com/users/Durkheim","html_url":"https://github.com/Durkheim","followers_url":"https://api.github.com/users/Durkheim/followers","following_url":"https://api.github.com/users/Durkheim/following{/other_user}","gists_url":"https://api.github.com/users/Durkheim/gists{/gist_id}","starred_url":"https://api.github.com/users/Durkheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Durkheim/subscriptions","organizations_url":"https://api.github.com/users/Durkheim/orgs","repos_url":"https://api.github.com/users/Durkheim/repos","events_url":"https://api.github.com/users/Durkheim/events{/privacy}","received_events_url":"https://api.github.com/users/Durkheim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex","description":"","fork":false,"url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex","forks_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/forks","keys_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/teams","hooks_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/hooks","issue_events_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/events{/number}","events_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/events","assignees_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/assignees{/user}","branches_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/branches{/branch}","tags_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/tags","blobs_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/refs{/sha}","trees_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/statuses/{sha}","languages_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/languages","stargazers_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/stargazers","contributors_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/contributors","subscribers_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/subscribers","subscription_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/subscription","commits_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/commits{/sha}","git_commits_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/git/commits{/sha}","comments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/comments{/number}","issue_comment_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/comments{/number}","contents_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/contents/{+path}","compare_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/merges","archive_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/downloads","issues_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues{/number}","pulls_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls{/number}","milestones_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/milestones{/number}","notifications_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/labels{/name}","releases_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/releases{/id}","deployments_url":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/deployments","created_at":"2016-02-04T17:35:54Z","updated_at":"2016-02-04T17:56:00Z","pushed_at":"2016-07-08T16:25:59Z","git_url":"git://github.com/Durkheim/String-Matching-Without-Scan-or-Regex.git","ssh_url":"git@github.com:Durkheim/String-Matching-Without-Scan-or-Regex.git","clone_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex.git","svn_url":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex","homepage":null,"size":50,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1"},"html":{"href":"https://github.com/Durkheim/String-Matching-Without-Scan-or-Regex/pull/1"},"issue":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/1"},"comments":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Durkheim/String-Matching-Without-Scan-or-Regex/statuses/3f78a692c24dd8a246c214718bd7a4715d6545bc"}}}}
{"actor":{"display_login":"tschady"}}