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)

@Schneems

irb(main):003> ENV["FOO"] = "0"
=> "0"
irb(main):004> !!ENV["FOO"]
=> true

Would you expect this behavior?

@getajobmike the most intuitive env var APIs for Ruby users are the ones that only check for presence rather than contents (imho) but I know some do what you’re describing

Unfortunately if you want to provide a default value for the env var (say, on Heroku) then there is no way to force unset a default config.

@Schneems @getajobmike if you want to validate more than just presence you could use this gem: https://github.com/fastruby/dotenv_validator 🤓
GitHub - fastruby/dotenv_validator: This gem check if required env variables are present and its format using the .env and .env.sample files from Dotenv.

This gem check if required env variables are present and its format using the .env and .env.sample files from Dotenv. - fastruby/dotenv_validator

GitHub