lib/tynn/environment.rb in tynn-0.0.2 vs lib/tynn/environment.rb in tynn-0.0.3
- old
+ new
@@ -1,10 +1,27 @@
+# Adds helper methods to get and check the current environment.
+#
+# require "tynn"
+# require "tynn/environment"
+#
+# Tynn.helpers(Tynn::Environment)
+#
+# Tynn.environment # => :development
+#
+# Tynn.development? # => true
+# Tynn.production? # => false
+# Tynn.test? # => false
+#
+# By default, the environment is based on `ENV["RACK_ENV"]`.
+#
+# Tynn.helpers(Tynn::Environment, env: ENV["RACK_ENV"])
+#
module Tynn::Environment
def self.setup(app, env: ENV["RACK_ENV"]) # :nodoc:
app.settings[:environment] = (env || :development).to_sym
end
- module ClassMethods
+ module ClassMethods # :nodoc:
def environment
return settings[:environment]
end
def development?