{"action":"opened","number":25,"pull_request":{"url":"https://api.github.com/repos/Shopify/measured/pulls/25","id":58063515,"html_url":"https://github.com/Shopify/measured/pull/25","diff_url":"https://github.com/Shopify/measured/pull/25.diff","patch_url":"https://github.com/Shopify/measured/pull/25.patch","issue_url":"https://api.github.com/repos/Shopify/measured/issues/25","number":25,"state":"open","locked":false,"title":"Respond to zero? through delegation","user":{"login":"kmcphillips","id":84159,"avatar_url":"https://avatars.githubusercontent.com/u/84159?v=3","gravatar_id":"","url":"https://api.github.com/users/kmcphillips","html_url":"https://github.com/kmcphillips","followers_url":"https://api.github.com/users/kmcphillips/followers","following_url":"https://api.github.com/users/kmcphillips/following{/other_user}","gists_url":"https://api.github.com/users/kmcphillips/gists{/gist_id}","starred_url":"https://api.github.com/users/kmcphillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmcphillips/subscriptions","organizations_url":"https://api.github.com/users/kmcphillips/orgs","repos_url":"https://api.github.com/users/kmcphillips/repos","events_url":"https://api.github.com/users/kmcphillips/events{/privacy}","received_events_url":"https://api.github.com/users/kmcphillips/received_events","type":"User","site_admin":false},"body":"@jonathanmwatson @garethson @RichardBlair @cyprusad \r\n\r\nWe should respond to `zero?` on `Measurable` since it doesn't matter what the unit is.\r\n\r\nDiscussion in another thread about if measured objects should respond to `to_i` and `to_f`. I think it's risky and undesirable for this reason:\r\n\r\n```ruby\r\na = Measured::Length.new(1, :cm)\r\nb = Measured::Length.new(1, :m)\r\na == b # false\r\na.to_i == b.to_i # true\r\n```\r\n\r\nIf you really want to work with the value as an int or float, you should have to explicitly ask for the value. I believe this is correct:\r\n\r\n```ruby\r\n> height.to_i\r\nNoMethodError: undefined method 'to_i' for #<Measured::Length: 1.0 cm>\r\nfrom (pry):10:in '<main>'\r\n> height.value.to_i\r\n=> 1\r\n```\r\n\r\nThoughts?","created_at":"2016-02-02T22:49:48Z","updated_at":"2016-02-02T22:49:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/measured/pulls/25/commits","review_comments_url":"https://api.github.com/repos/Shopify/measured/pulls/25/comments","review_comment_url":"https://api.github.com/repos/Shopify/measured/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/measured/issues/25/comments","statuses_url":"https://api.github.com/repos/Shopify/measured/statuses/fbfc23d2c522a926d3812202b3e73df98beba07f","head":{"label":"Shopify:zero-questionmark-delegate-to-value","ref":"zero-questionmark-delegate-to-value","sha":"fbfc23d2c522a926d3812202b3e73df98beba07f","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":31614166,"name":"measured","full_name":"Shopify/measured","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/measured","description":"Encapsulate measurements and their units in Ruby.","fork":false,"url":"https://api.github.com/repos/Shopify/measured","forks_url":"https://api.github.com/repos/Shopify/measured/forks","keys_url":"https://api.github.com/repos/Shopify/measured/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/measured/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/measured/teams","hooks_url":"https://api.github.com/repos/Shopify/measured/hooks","issue_events_url":"https://api.github.com/repos/Shopify/measured/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/measured/events","assignees_url":"https://api.github.com/repos/Shopify/measured/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/measured/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/measured/tags","blobs_url":"https://api.github.com/repos/Shopify/measured/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/measured/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/measured/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/measured/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/measured/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/measured/languages","stargazers_url":"https://api.github.com/repos/Shopify/measured/stargazers","contributors_url":"https://api.github.com/repos/Shopify/measured/contributors","subscribers_url":"https://api.github.com/repos/Shopify/measured/subscribers","subscription_url":"https://api.github.com/repos/Shopify/measured/subscription","commits_url":"https://api.github.com/repos/Shopify/measured/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/measured/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/measured/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/measured/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/measured/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/measured/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/measured/merges","archive_url":"https://api.github.com/repos/Shopify/measured/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/measured/downloads","issues_url":"https://api.github.com/repos/Shopify/measured/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/measured/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/measured/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/measured/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/measured/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/measured/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/measured/deployments","created_at":"2015-03-03T18:29:09Z","updated_at":"2016-01-27T17:42:40Z","pushed_at":"2016-02-02T22:46:09Z","git_url":"git://github.com/Shopify/measured.git","ssh_url":"git@github.com:Shopify/measured.git","clone_url":"https://github.com/Shopify/measured.git","svn_url":"https://github.com/Shopify/measured","homepage":"","size":61,"stargazers_count":25,"watchers_count":25,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":25,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"27642d35e0f7ad68bf96f78ba985ed97999ace9b","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":31614166,"name":"measured","full_name":"Shopify/measured","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/measured","description":"Encapsulate measurements and their units in Ruby.","fork":false,"url":"https://api.github.com/repos/Shopify/measured","forks_url":"https://api.github.com/repos/Shopify/measured/forks","keys_url":"https://api.github.com/repos/Shopify/measured/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/measured/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/measured/teams","hooks_url":"https://api.github.com/repos/Shopify/measured/hooks","issue_events_url":"https://api.github.com/repos/Shopify/measured/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/measured/events","assignees_url":"https://api.github.com/repos/Shopify/measured/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/measured/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/measured/tags","blobs_url":"https://api.github.com/repos/Shopify/measured/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/measured/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/measured/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/measured/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/measured/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/measured/languages","stargazers_url":"https://api.github.com/repos/Shopify/measured/stargazers","contributors_url":"https://api.github.com/repos/Shopify/measured/contributors","subscribers_url":"https://api.github.com/repos/Shopify/measured/subscribers","subscription_url":"https://api.github.com/repos/Shopify/measured/subscription","commits_url":"https://api.github.com/repos/Shopify/measured/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/measured/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/measured/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/measured/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/measured/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/measured/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/measured/merges","archive_url":"https://api.github.com/repos/Shopify/measured/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/measured/downloads","issues_url":"https://api.github.com/repos/Shopify/measured/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/measured/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/measured/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/measured/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/measured/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/measured/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/measured/deployments","created_at":"2015-03-03T18:29:09Z","updated_at":"2016-01-27T17:42:40Z","pushed_at":"2016-02-02T22:46:09Z","git_url":"git://github.com/Shopify/measured.git","ssh_url":"git@github.com:Shopify/measured.git","clone_url":"https://github.com/Shopify/measured.git","svn_url":"https://github.com/Shopify/measured","homepage":"","size":61,"stargazers_count":25,"watchers_count":25,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/measured/pulls/25"},"html":{"href":"https://github.com/Shopify/measured/pull/25"},"issue":{"href":"https://api.github.com/repos/Shopify/measured/issues/25"},"comments":{"href":"https://api.github.com/repos/Shopify/measured/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/measured/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/measured/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/measured/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/measured/statuses/fbfc23d2c522a926d3812202b3e73df98beba07f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":7,"deletions":0,"changed_files":2}}