Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Test RAILS_ENV

I got tired of typing ENV["RAILS_ENV"] == "test" over and over in my app so I came up with a method for a mixin.

   1  
   2  module Mesclun
   3    def env?(val)
   4      ENV["RAILS_ENV"] == case val
   5        when :dev, :devel, :development: "development"
   6        when :pro, :prod, :production: "production"
   7        when :test; "test"
   8      end
   9    end
  10  end


Pretty simple but a real finger-saver, for me at least. :)
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS