Sha256: 20b97a044a3d42ff887e026734456eef0ed614d246d5f256a3bb9320ddfbcb18
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true %w[ dry/inflector envlogic/version envlogic/env ].each { |lib| require lib } # 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 module Envlogic # @return [Envlogic::Env] envlogic env instance that allows us to check environment # @example Invoke env in TestClass # TestClass.env #=> Envlogic::Env instance def env @env ||= Envlogic::Env.new(self) end # @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 def env=(environment) env.update(environment.to_s) end # We alias this for backward compatibility with some code that uses full names alias environment env alias environment= env= end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
envlogic-1.1.5 | lib/envlogic.rb |
envlogic-1.1.4 | lib/envlogic.rb |
envlogic-1.1.3 | lib/envlogic.rb |
envlogic-1.1.2 | lib/envlogic.rb |
envlogic-1.1.1 | lib/envlogic.rb |