module Envlogic
Main module that encapsulates logic that should be used to extend any class/module @note This module should be extended/included into the class/module in which we want to have
env support
@example Use it in RandomClass class
class RandomClass extend Envlogic end RandomClass.env #=> Envlogic::Env instance RandomClass.env.production? #=> false RandomClass.env.development? #=> true
@example Use it for instances of objects
class RandomClass include Envlogic end instance = RandomClass.new instance.env #=> Envlogic::Env instance instance.env.production? #=> false instance.env.development? #=> true
Main module
Main module to encapsulate logic
Constants
- VERSION
Current version of gem
Public Instance Methods
env()
click to toggle source
@return [Envlogic::Env] envlogic env instance that allows us to check environment @example Invoke env in TestClass
TestClass.env #=> Envlogic::Env instance
# File lib/envlogic.rb, line 35 def env @env ||= Envlogic::Env.new(self) end
Also aliased as: environment
env=(environment)
click to toggle source
@param environment [String, Symbol] new environment that we want to set @return [Envlogic::Env] envlogic env instance @example Assign new environment to MyApp
MyApp.env = :production
# File lib/envlogic.rb, line 43 def env=(environment) env.update(environment.to_s) end
Also aliased as: environment=
environment()
We alias this for backward compatibility with some code that uses full names
Alias for: env