Sha256: c94c01b43bccd5334bc778d614d3f606339a04829130b1cbdd90f6b0b00883b1

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

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

module Napa
  class << self
    def load_environment
      Dotenv.load(Napa.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
napa-0.4.3 lib/napa/setup.rb
napa-0.4.1 lib/napa/setup.rb
napa-0.4.0 lib/napa/setup.rb