Sha256: 79590f2e44bf6df7966707a76cf47a5545100b1f79f9dfd72740c937c572e789

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

# setup for service_template
# require the files that are required before everything else in service_template
# useful if you want to use any variables/methods defined here without loading the rest of service_template immediately
require 'active_support'

module ServiceTemplate
  class << self
    def load_environment
      Dotenv.load(ServiceTemplate.env.test? ? '.env.test' : '.env')
    end

    def skip_initialization
      @_skip_initialization || false
    end

    def skip_initialization=(value)
      @_skip_initialization = value if [TrueClass, FalseClass].include?(value.class)
    end

    def env
      @_env ||= ActiveSupport::StringInquirer.new(ENV['RACK_ENV'] || 'development')
    end

    def env=(environment)
      @_env = ActiveSupport::StringInquirer.new(environment)
    end

    def cache
      @_cache ||= ActiveSupport::Cache.lookup_store(:memory_store)
    end

    def cache=(store_option)
      @_cache = ActiveSupport::Cache.lookup_store(store_option)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
service_template-0.5.2 lib/service_template/setup.rb
service_template-0.5.1 lib/service_template/setup.rb
service_template-0.5.0 lib/service_template/setup.rb