{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/591","repository_url":"https://api.github.com/repos/bbatsov/ruby-style-guide","labels_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/591/comments","events_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/591/events","html_url":"https://github.com/bbatsov/ruby-style-guide/issues/591","id":167578881,"number":591,"title":"Style/DoubleNegation should be allowed for return values","user":{"login":"donv","id":57275,"avatar_url":"https://avatars1.githubusercontent.com/u/57275?v=4","gravatar_id":"","url":"https://api.github.com/users/donv","html_url":"https://github.com/donv","followers_url":"https://api.github.com/users/donv/followers","following_url":"https://api.github.com/users/donv/following{/other_user}","gists_url":"https://api.github.com/users/donv/gists{/gist_id}","starred_url":"https://api.github.com/users/donv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donv/subscriptions","organizations_url":"https://api.github.com/users/donv/orgs","repos_url":"https://api.github.com/users/donv/repos","events_url":"https://api.github.com/users/donv/events{/privacy}","received_events_url":"https://api.github.com/users/donv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-07-26T10:54:06Z","updated_at":"2018-05-25T15:18:37Z","closed_at":null,"author_association":"NONE","body":"Hi!\n\nA typical pattern is to have a boolean query to read object state that is not stored as a boolean inside the object:\n\n``` ruby\nclass MyClass\n  def close\n    @closed_at = Time.now\n  end\n\n  def closed?\n    !!@closed_at\n  end\nend\n```\n\nThe conversion to boolean is to encapsulate the inner state of the object.  The double negation is idiomatic for \"convert to boolean\".  I agree with the style guide that it should not be used in control flow, but I think it is good style when using outside control flow.\n\nRubocop 0.41.1 lists the above as an offence.  It should not since the double negation is not in a control flow.\n"},"comment":{"url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/comments/392091228","html_url":"https://github.com/bbatsov/ruby-style-guide/issues/591#issuecomment-392091228","issue_url":"https://api.github.com/repos/bbatsov/ruby-style-guide/issues/591","id":392091228,"user":{"login":"mikegee","id":14068,"avatar_url":"https://avatars3.githubusercontent.com/u/14068?v=4","gravatar_id":"","url":"https://api.github.com/users/mikegee","html_url":"https://github.com/mikegee","followers_url":"https://api.github.com/users/mikegee/followers","following_url":"https://api.github.com/users/mikegee/following{/other_user}","gists_url":"https://api.github.com/users/mikegee/gists{/gist_id}","starred_url":"https://api.github.com/users/mikegee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikegee/subscriptions","organizations_url":"https://api.github.com/users/mikegee/orgs","repos_url":"https://api.github.com/users/mikegee/repos","events_url":"https://api.github.com/users/mikegee/events{/privacy}","received_events_url":"https://api.github.com/users/mikegee/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T15:18:37Z","updated_at":"2018-05-25T15:18:37Z","author_association":"NONE","body":"@gkop this is highly debated, but I claim it is most idiomatic to not convert to boolean; leave the value \"truthy\" or \"falsey\", not explicitly `true` or `false`.\r\n"}}
{"actor":{"display_login":"mikegee"}}