Sha256: 778f9a4c49b973b90a6099858d759274375aa48066f18601beb49eae2f4ee54e

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

module Enviro
  module Environment

    def self.included(base)
      base.send(:extend,  ClassMethods)
    end

    module ClassMethods
      def environment
        @environment ||= _setup_environment
      end

      def environment=(value)
        @environment = value
      end
      alias :env :environment

      def env?(value)
        self.environment == value.to_sym
      end

      private

        def _setup_environment
          if defined?(Rails)
            Rails.env
          else
            ENV['ENVY_ENV'].nil? ? :development : ENV['ENVY_ENV'].to_sym
          end
        end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enviro-0.0.4 lib/enviro/environment.rb
enviro-0.0.3 lib/enviro/environment.rb
enviro-0.0.2 lib/enviro/environment.rb
enviro-0.0.1 lib/enviro/environment.rb