Ruby has Integer(...) and Float(...), but does it have Boolean(…) for things like:
Boolean(ENV[“SOME_FLAG”])
What's the Ruby idiom here?
Ruby has Integer(...) and Float(...), but does it have Boolean(…) for things like:
Boolean(ENV[“SOME_FLAG”])
What's the Ruby idiom here?
@getajobmike Nancy Sinatra it:
Bang bang (my baby shot me down)
irb(main):003> ENV["FOO"] = "0"
=> "0"
irb(main):004> !!ENV["FOO"]
=> true
Would you expect this behavior?
@getajobmike Just today I noticed this is how it works. In a Rails controller `request.xhr? # => 0` when true.
I think JS is, infamously, the only language where you'd expect `!!"0" == true`.