{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/35461777","id":35461777,"diff_hunk":"@@ -7,7 +7,7 @@ class String\n   #   env = 'production'.inquiry\n   #   env.production?  # => true\n   #   env.development? # => false\n-  def inquiry\n-    ActiveSupport::StringInquirer.new(self)\n+  def inquiry(*valid_values)","path":"activesupport/lib/active_support/core_ext/string/inquiry.rb","position":6,"original_position":6,"commit_id":"ee44820075031b57dee01691183b7510e9eb29af","original_commit_id":"ee44820075031b57dee01691183b7510e9eb29af","user":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"body":"Lets use a `restricted_to` optional keyword argument. `inquiry('pending', 'active')` doesn't read nice to me.","created_at":"2015-07-24T20:19:24Z","updated_at":"2015-07-24T20:19:24Z","html_url":"https://github.com/rails/rails/pull/20943#discussion_r35461777","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/20943","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/35461777"},"html":{"href":"https://github.com/rails/rails/pull/20943#discussion_r35461777"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/20943"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/20943","id":40305895,"html_url":"https://github.com/rails/rails/pull/20943","diff_url":"https://github.com/rails/rails/pull/20943.diff","patch_url":"https://github.com/rails/rails/pull/20943.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/20943","number":20943,"state":"open","locked":false,"title":"Extend `ActiveSupport::StringInquirer` to specify valid values","user":{"login":"rafaelsales","id":1196663,"avatar_url":"https://avatars.githubusercontent.com/u/1196663?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelsales","html_url":"https://github.com/rafaelsales","followers_url":"https://api.github.com/users/rafaelsales/followers","following_url":"https://api.github.com/users/rafaelsales/following{/other_user}","gists_url":"https://api.github.com/users/rafaelsales/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelsales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelsales/subscriptions","organizations_url":"https://api.github.com/users/rafaelsales/orgs","repos_url":"https://api.github.com/users/rafaelsales/repos","events_url":"https://api.github.com/users/rafaelsales/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelsales/received_events","type":"User","site_admin":false},"body":"`StringInquirer` now supports specifying which values are valid so that only a specific set of *inquiries* can be called on it. Example:\r\n\r\n```ruby\r\nclass Offer < Struct.new(:status)\r\n  VALID_STATUSES = %w(pending active finished)\r\n\r\n  def status\r\n    super.inquiry(VALID_STATUSES)\r\n  end\r\nend\r\n\r\n> Offer.new('pending').status.pending?\r\n=> true\r\n\r\n> Offer.new('finished').status.active?\r\n=> false\r\n\r\n> Offer.new('ended').status.ended?\r\nNoMethodError: undefined method `ended?` for \"ended\":ActiveSupport::StringInquirer\r\n\r\n> Offer.new('active').status.valid_values\r\n=> [\"pending\", \"active\", \"finished\"]\r\n```\r\n\r\nCurrent existing behavior of `StringInquiry` is preserved if a list of valid values is not specified:\r\n```ruby\r\n> 'pending'.inquiry.pending?\r\n=> true\r\n\r\n> 'active'.inquiry.whaaat?\r\n=> false\r\n```","created_at":"2015-07-19T09:47:24Z","updated_at":"2015-07-24T20:19:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b2e9c5c6115bc12c58411be32f28b91bb5e2445","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/20943/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/20943/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/20943/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/ee44820075031b57dee01691183b7510e9eb29af","head":{"label":"rafaelsales:better_string_inquiry","ref":"better_string_inquiry","sha":"ee44820075031b57dee01691183b7510e9eb29af","user":{"login":"rafaelsales","id":1196663,"avatar_url":"https://avatars.githubusercontent.com/u/1196663?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelsales","html_url":"https://github.com/rafaelsales","followers_url":"https://api.github.com/users/rafaelsales/followers","following_url":"https://api.github.com/users/rafaelsales/following{/other_user}","gists_url":"https://api.github.com/users/rafaelsales/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelsales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelsales/subscriptions","organizations_url":"https://api.github.com/users/rafaelsales/orgs","repos_url":"https://api.github.com/users/rafaelsales/repos","events_url":"https://api.github.com/users/rafaelsales/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelsales/received_events","type":"User","site_admin":false},"repo":{"id":32473092,"name":"rails","full_name":"rafaelsales/rails","owner":{"login":"rafaelsales","id":1196663,"avatar_url":"https://avatars.githubusercontent.com/u/1196663?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelsales","html_url":"https://github.com/rafaelsales","followers_url":"https://api.github.com/users/rafaelsales/followers","following_url":"https://api.github.com/users/rafaelsales/following{/other_user}","gists_url":"https://api.github.com/users/rafaelsales/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelsales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelsales/subscriptions","organizations_url":"https://api.github.com/users/rafaelsales/orgs","repos_url":"https://api.github.com/users/rafaelsales/repos","events_url":"https://api.github.com/users/rafaelsales/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelsales/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rafaelsales/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/rafaelsales/rails","forks_url":"https://api.github.com/repos/rafaelsales/rails/forks","keys_url":"https://api.github.com/repos/rafaelsales/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rafaelsales/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rafaelsales/rails/teams","hooks_url":"https://api.github.com/repos/rafaelsales/rails/hooks","issue_events_url":"https://api.github.com/repos/rafaelsales/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rafaelsales/rails/events","assignees_url":"https://api.github.com/repos/rafaelsales/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rafaelsales/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rafaelsales/rails/tags","blobs_url":"https://api.github.com/repos/rafaelsales/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rafaelsales/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rafaelsales/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rafaelsales/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rafaelsales/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rafaelsales/rails/languages","stargazers_url":"https://api.github.com/repos/rafaelsales/rails/stargazers","contributors_url":"https://api.github.com/repos/rafaelsales/rails/contributors","subscribers_url":"https://api.github.com/repos/rafaelsales/rails/subscribers","subscription_url":"https://api.github.com/repos/rafaelsales/rails/subscription","commits_url":"https://api.github.com/repos/rafaelsales/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rafaelsales/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rafaelsales/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rafaelsales/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rafaelsales/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rafaelsales/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rafaelsales/rails/merges","archive_url":"https://api.github.com/repos/rafaelsales/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rafaelsales/rails/downloads","issues_url":"https://api.github.com/repos/rafaelsales/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rafaelsales/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rafaelsales/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rafaelsales/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rafaelsales/rails/labels{/name}","releases_url":"https://api.github.com/repos/rafaelsales/rails/releases{/id}","created_at":"2015-03-18T17:17:20Z","updated_at":"2015-03-18T17:17:55Z","pushed_at":"2015-07-22T21:13:22Z","git_url":"git://github.com/rafaelsales/rails.git","ssh_url":"git@github.com:rafaelsales/rails.git","clone_url":"https://github.com/rafaelsales/rails.git","svn_url":"https://github.com/rafaelsales/rails","homepage":"http://rubyonrails.org","size":143603,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"rails:master","ref":"master","sha":"52cf1a71b393486435fab4386a8663b146608996","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-07-24T19:22:52Z","pushed_at":"2015-07-24T18:45:24Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":433185,"stargazers_count":27014,"watchers_count":27014,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10816,"mirror_url":null,"open_issues_count":881,"forks":10816,"open_issues":881,"watchers":27014,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/20943"},"html":{"href":"https://github.com/rails/rails/pull/20943"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/20943"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/20943/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/20943/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/20943/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/ee44820075031b57dee01691183b7510e9eb29af"}}}}