{"action":"closed","issue":{"url":"https://api.github.com/repos/ignat-z/ducalis/issues/94","repository_url":"https://api.github.com/repos/ignat-z/ducalis","labels_url":"https://api.github.com/repos/ignat-z/ducalis/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/ignat-z/ducalis/issues/94/comments","events_url":"https://api.github.com/repos/ignat-z/ducalis/issues/94/events","html_url":"https://github.com/ignat-z/ducalis/issues/94","id":310537322,"number":94,"title":"Invalid hint on Ducalis/FetchExpression","user":{"login":"mensfeld","id":392754,"avatar_url":"https://avatars3.githubusercontent.com/u/392754?v=4","gravatar_id":"","url":"https://api.github.com/users/mensfeld","html_url":"https://github.com/mensfeld","followers_url":"https://api.github.com/users/mensfeld/followers","following_url":"https://api.github.com/users/mensfeld/following{/other_user}","gists_url":"https://api.github.com/users/mensfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/mensfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mensfeld/subscriptions","organizations_url":"https://api.github.com/users/mensfeld/orgs","repos_url":"https://api.github.com/users/mensfeld/repos","events_url":"https://api.github.com/users/mensfeld/events{/privacy}","received_events_url":"https://api.github.com/users/mensfeld/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-02T16:49:14Z","updated_at":"2018-05-05T13:30:51Z","closed_at":"2018-05-05T13:30:51Z","author_association":"NONE","body":"Given:\r\n\r\n```ruby\r\nday = params[:day] || Time.zone.today\r\n```\r\n\r\nDucalis states as followed:\r\n\r\nYou can use fetch instead:\r\n\r\n```ruby\r\nparams.fetch(:day) { Time.zone.today }\r\n```\r\n\r\nbut it is not the same for the nil case:\r\n\r\n```ruby\r\nparams = {}\r\nparams[:day] || Time.zone.today #=> Time.zone.today result\r\n\r\nparams = { day: nil }\r\nparams.fetch(:day) { Time.zone.today } #=> nil\r\n```\r\n\r\nthis should not be suggested as better as the expression result is not the same and the cases may differ."}}
{"actor":{"display_login":"ignat-z"}}