I’m sure you’ve noticed the magical Rails.env
Rails.env # => "development"
# This also works...
Rails.env.development? # => true
If you need your strings to work the same way, use the super-charged, ActiveSupport::StringInquirer which inherits from the String class.
movie = ActiveSupport::StringInquirer.new "godfather"
movie == "godfather" # => true
movie.godfather? # => true
movie.dirty_harry? # => false
If you want to use ActiveSupport::StringInquirer outside of Rails, then you need the activesupport gem installed and require “active_support/string_inquirer”.