Skip to content

Instantly share code, notes, and snippets.

@aclarke-iseatz
Created December 18, 2012 19:44
Show Gist options
  • Save aclarke-iseatz/4331248 to your computer and use it in GitHub Desktop.
Save aclarke-iseatz/4331248 to your computer and use it in GitHub Desktop.
require 'active_support/string_inquirer'
module Farts
module Environment
def env
# only want to set this value if it doesn't already have one
file_name = '/Users/aclarke/tmp/environment'
# don't even bother to set this if it's already been set (||=)
@@_env_file ||= File.exists?(file_name) ? File.read(file_name).strip : "development"
@@_env ||= ActiveSupport::StringInquirer.new @@_env_file
end
end
end
class Poop
extend Farts::Environment
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment