News for hackers. Stuff that matters.
Re:Reverse Engineering One Line of JavaScript by drusepth on Friday July 14, 2017 @07:28AM (#14768979)
Because Ruby doesn't have a to_boolean method. !! is used to convert "truthy" or "falsy" values [0] into true boolean true or false values.

For example,

    def user_signed_in?
      !!current_user
    end
This returns "true" or "false", instead of a (truthy) User object or a (falsy) nil.

[0] https://gist.github.com/jfarmer/2647362

There are no comments on this comment yet.