{"action":"created","comment":{"url":"https://api.github.com/repos/soveran/micromachine/pulls/comments/44156539","id":44156539,"diff_hunk":"@@ -44,9 +49,21 @@ def states\n private\n \n   def change(event)\n-    @state = transitions_for[event][@state]\n+    previous_state, @state = @state, transitions_for[event][@state]\n+\n+    all_arguments = [event, previous_state, state]","path":"lib/micromachine.rb","position":19,"original_position":19,"commit_id":"957aaf20d0ff5d76e9e3d4810777246d68fb52ed","original_commit_id":"957aaf20d0ff5d76e9e3d4810777246d68fb52ed","user":{"login":"y8","id":80930,"avatar_url":"https://avatars.githubusercontent.com/u/80930?v=3","gravatar_id":"","url":"https://api.github.com/users/y8","html_url":"https://github.com/y8","followers_url":"https://api.github.com/users/y8/followers","following_url":"https://api.github.com/users/y8/following{/other_user}","gists_url":"https://api.github.com/users/y8/gists{/gist_id}","starred_url":"https://api.github.com/users/y8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y8/subscriptions","organizations_url":"https://api.github.com/users/y8/orgs","repos_url":"https://api.github.com/users/y8/repos","events_url":"https://api.github.com/users/y8/events{/privacy}","received_events_url":"https://api.github.com/users/y8/received_events","type":"User","site_admin":false},"body":"Nope. \r\n\r\nThere interface to access the state: `state` method. Direct reads from the internal state representation are breaking encapsulation. Should the `@state` representation change, for example, to hold integer values internally, it will break code that reads ivars directly.\r\n\r\nSpeaking from the SOLID point of view, there too much responsibilities on the `change` method. Because not it only changes the state, but also notifies callbacks. Ideally, callback notification code should be extracted to the, um, `notify` method. ","created_at":"2015-11-06T16:30:50Z","updated_at":"2015-11-06T16:30:50Z","html_url":"https://github.com/soveran/micromachine/pull/31#discussion_r44156539","pull_request_url":"https://api.github.com/repos/soveran/micromachine/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/comments/44156539"},"html":{"href":"https://github.com/soveran/micromachine/pull/31#discussion_r44156539"},"pull_request":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/soveran/micromachine/pulls/31","id":49955437,"html_url":"https://github.com/soveran/micromachine/pull/31","diff_url":"https://github.com/soveran/micromachine/pull/31.diff","patch_url":"https://github.com/soveran/micromachine/pull/31.patch","issue_url":"https://api.github.com/repos/soveran/micromachine/issues/31","number":31,"state":"open","locked":false,"title":"Pass previous and current state to the callback","user":{"login":"y8","id":80930,"avatar_url":"https://avatars.githubusercontent.com/u/80930?v=3","gravatar_id":"","url":"https://api.github.com/users/y8","html_url":"https://github.com/y8","followers_url":"https://api.github.com/users/y8/followers","following_url":"https://api.github.com/users/y8/following{/other_user}","gists_url":"https://api.github.com/users/y8/gists{/gist_id}","starred_url":"https://api.github.com/users/y8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y8/subscriptions","organizations_url":"https://api.github.com/users/y8/orgs","repos_url":"https://api.github.com/users/y8/repos","events_url":"https://api.github.com/users/y8/events{/privacy}","received_events_url":"https://api.github.com/users/y8/received_events","type":"User","site_admin":false},"body":"Pretty much the same as #27. ","created_at":"2015-11-06T13:50:43Z","updated_at":"2015-11-06T16:30:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9003491883fc8deeb73cdbeae04809eb59202c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/soveran/micromachine/pulls/31/commits","review_comments_url":"https://api.github.com/repos/soveran/micromachine/pulls/31/comments","review_comment_url":"https://api.github.com/repos/soveran/micromachine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/soveran/micromachine/issues/31/comments","statuses_url":"https://api.github.com/repos/soveran/micromachine/statuses/957aaf20d0ff5d76e9e3d4810777246d68fb52ed","head":{"label":"y8:master","ref":"master","sha":"957aaf20d0ff5d76e9e3d4810777246d68fb52ed","user":{"login":"y8","id":80930,"avatar_url":"https://avatars.githubusercontent.com/u/80930?v=3","gravatar_id":"","url":"https://api.github.com/users/y8","html_url":"https://github.com/y8","followers_url":"https://api.github.com/users/y8/followers","following_url":"https://api.github.com/users/y8/following{/other_user}","gists_url":"https://api.github.com/users/y8/gists{/gist_id}","starred_url":"https://api.github.com/users/y8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y8/subscriptions","organizations_url":"https://api.github.com/users/y8/orgs","repos_url":"https://api.github.com/users/y8/repos","events_url":"https://api.github.com/users/y8/events{/privacy}","received_events_url":"https://api.github.com/users/y8/received_events","type":"User","site_admin":false},"repo":{"id":45641886,"name":"micromachine","full_name":"y8/micromachine","owner":{"login":"y8","id":80930,"avatar_url":"https://avatars.githubusercontent.com/u/80930?v=3","gravatar_id":"","url":"https://api.github.com/users/y8","html_url":"https://github.com/y8","followers_url":"https://api.github.com/users/y8/followers","following_url":"https://api.github.com/users/y8/following{/other_user}","gists_url":"https://api.github.com/users/y8/gists{/gist_id}","starred_url":"https://api.github.com/users/y8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/y8/subscriptions","organizations_url":"https://api.github.com/users/y8/orgs","repos_url":"https://api.github.com/users/y8/repos","events_url":"https://api.github.com/users/y8/events{/privacy}","received_events_url":"https://api.github.com/users/y8/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/y8/micromachine","description":"Minimal Finite State Machine","fork":true,"url":"https://api.github.com/repos/y8/micromachine","forks_url":"https://api.github.com/repos/y8/micromachine/forks","keys_url":"https://api.github.com/repos/y8/micromachine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/y8/micromachine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/y8/micromachine/teams","hooks_url":"https://api.github.com/repos/y8/micromachine/hooks","issue_events_url":"https://api.github.com/repos/y8/micromachine/issues/events{/number}","events_url":"https://api.github.com/repos/y8/micromachine/events","assignees_url":"https://api.github.com/repos/y8/micromachine/assignees{/user}","branches_url":"https://api.github.com/repos/y8/micromachine/branches{/branch}","tags_url":"https://api.github.com/repos/y8/micromachine/tags","blobs_url":"https://api.github.com/repos/y8/micromachine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/y8/micromachine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/y8/micromachine/git/refs{/sha}","trees_url":"https://api.github.com/repos/y8/micromachine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/y8/micromachine/statuses/{sha}","languages_url":"https://api.github.com/repos/y8/micromachine/languages","stargazers_url":"https://api.github.com/repos/y8/micromachine/stargazers","contributors_url":"https://api.github.com/repos/y8/micromachine/contributors","subscribers_url":"https://api.github.com/repos/y8/micromachine/subscribers","subscription_url":"https://api.github.com/repos/y8/micromachine/subscription","commits_url":"https://api.github.com/repos/y8/micromachine/commits{/sha}","git_commits_url":"https://api.github.com/repos/y8/micromachine/git/commits{/sha}","comments_url":"https://api.github.com/repos/y8/micromachine/comments{/number}","issue_comment_url":"https://api.github.com/repos/y8/micromachine/issues/comments{/number}","contents_url":"https://api.github.com/repos/y8/micromachine/contents/{+path}","compare_url":"https://api.github.com/repos/y8/micromachine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/y8/micromachine/merges","archive_url":"https://api.github.com/repos/y8/micromachine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/y8/micromachine/downloads","issues_url":"https://api.github.com/repos/y8/micromachine/issues{/number}","pulls_url":"https://api.github.com/repos/y8/micromachine/pulls{/number}","milestones_url":"https://api.github.com/repos/y8/micromachine/milestones{/number}","notifications_url":"https://api.github.com/repos/y8/micromachine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/y8/micromachine/labels{/name}","releases_url":"https://api.github.com/repos/y8/micromachine/releases{/id}","created_at":"2015-11-05T21:54:53Z","updated_at":"2015-11-05T21:54:54Z","pushed_at":"2015-11-06T13:49:29Z","git_url":"git://github.com/y8/micromachine.git","ssh_url":"git@github.com:y8/micromachine.git","clone_url":"https://github.com/y8/micromachine.git","svn_url":"https://github.com/y8/micromachine","homepage":"","size":293,"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":"soveran:master","ref":"master","sha":"5d1cfb508e53084dc202f1740afb4858e4b9e52f","user":{"login":"soveran","id":951,"avatar_url":"https://avatars.githubusercontent.com/u/951?v=3","gravatar_id":"","url":"https://api.github.com/users/soveran","html_url":"https://github.com/soveran","followers_url":"https://api.github.com/users/soveran/followers","following_url":"https://api.github.com/users/soveran/following{/other_user}","gists_url":"https://api.github.com/users/soveran/gists{/gist_id}","starred_url":"https://api.github.com/users/soveran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soveran/subscriptions","organizations_url":"https://api.github.com/users/soveran/orgs","repos_url":"https://api.github.com/users/soveran/repos","events_url":"https://api.github.com/users/soveran/events{/privacy}","received_events_url":"https://api.github.com/users/soveran/received_events","type":"User","site_admin":false},"repo":{"id":145003,"name":"micromachine","full_name":"soveran/micromachine","owner":{"login":"soveran","id":951,"avatar_url":"https://avatars.githubusercontent.com/u/951?v=3","gravatar_id":"","url":"https://api.github.com/users/soveran","html_url":"https://github.com/soveran","followers_url":"https://api.github.com/users/soveran/followers","following_url":"https://api.github.com/users/soveran/following{/other_user}","gists_url":"https://api.github.com/users/soveran/gists{/gist_id}","starred_url":"https://api.github.com/users/soveran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soveran/subscriptions","organizations_url":"https://api.github.com/users/soveran/orgs","repos_url":"https://api.github.com/users/soveran/repos","events_url":"https://api.github.com/users/soveran/events{/privacy}","received_events_url":"https://api.github.com/users/soveran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/soveran/micromachine","description":"Minimal Finite State Machine","fork":false,"url":"https://api.github.com/repos/soveran/micromachine","forks_url":"https://api.github.com/repos/soveran/micromachine/forks","keys_url":"https://api.github.com/repos/soveran/micromachine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/soveran/micromachine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/soveran/micromachine/teams","hooks_url":"https://api.github.com/repos/soveran/micromachine/hooks","issue_events_url":"https://api.github.com/repos/soveran/micromachine/issues/events{/number}","events_url":"https://api.github.com/repos/soveran/micromachine/events","assignees_url":"https://api.github.com/repos/soveran/micromachine/assignees{/user}","branches_url":"https://api.github.com/repos/soveran/micromachine/branches{/branch}","tags_url":"https://api.github.com/repos/soveran/micromachine/tags","blobs_url":"https://api.github.com/repos/soveran/micromachine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/soveran/micromachine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/soveran/micromachine/git/refs{/sha}","trees_url":"https://api.github.com/repos/soveran/micromachine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/soveran/micromachine/statuses/{sha}","languages_url":"https://api.github.com/repos/soveran/micromachine/languages","stargazers_url":"https://api.github.com/repos/soveran/micromachine/stargazers","contributors_url":"https://api.github.com/repos/soveran/micromachine/contributors","subscribers_url":"https://api.github.com/repos/soveran/micromachine/subscribers","subscription_url":"https://api.github.com/repos/soveran/micromachine/subscription","commits_url":"https://api.github.com/repos/soveran/micromachine/commits{/sha}","git_commits_url":"https://api.github.com/repos/soveran/micromachine/git/commits{/sha}","comments_url":"https://api.github.com/repos/soveran/micromachine/comments{/number}","issue_comment_url":"https://api.github.com/repos/soveran/micromachine/issues/comments{/number}","contents_url":"https://api.github.com/repos/soveran/micromachine/contents/{+path}","compare_url":"https://api.github.com/repos/soveran/micromachine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/soveran/micromachine/merges","archive_url":"https://api.github.com/repos/soveran/micromachine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/soveran/micromachine/downloads","issues_url":"https://api.github.com/repos/soveran/micromachine/issues{/number}","pulls_url":"https://api.github.com/repos/soveran/micromachine/pulls{/number}","milestones_url":"https://api.github.com/repos/soveran/micromachine/milestones{/number}","notifications_url":"https://api.github.com/repos/soveran/micromachine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/soveran/micromachine/labels{/name}","releases_url":"https://api.github.com/repos/soveran/micromachine/releases{/id}","created_at":"2009-03-07T04:21:33Z","updated_at":"2015-11-05T06:30:20Z","pushed_at":"2015-11-06T14:01:34Z","git_url":"git://github.com/soveran/micromachine.git","ssh_url":"git@github.com:soveran/micromachine.git","clone_url":"https://github.com/soveran/micromachine.git","svn_url":"https://github.com/soveran/micromachine","homepage":"","size":293,"stargazers_count":331,"watchers_count":331,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":3,"forks":30,"open_issues":3,"watchers":331,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/31"},"html":{"href":"https://github.com/soveran/micromachine/pull/31"},"issue":{"href":"https://api.github.com/repos/soveran/micromachine/issues/31"},"comments":{"href":"https://api.github.com/repos/soveran/micromachine/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/soveran/micromachine/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/soveran/micromachine/statuses/957aaf20d0ff5d76e9e3d4810777246d68fb52ed"}}}}