Class: Rack::Sprocketize::Config

Inherits:
Valuable
  • Object
show all
Defined in:
lib/rack/sprocketize/config.rb

Overview

Configuration options for Rack::Sprocketize.

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
# File 'lib/rack/sprocketize/config.rb', line 8

def initialize(*args)
  super
  self.always_compress = environment == 'production'  if always_compress.nil?
  self.always_check    = environment == 'development' if always_check.nil?
end

Instance Method Details

#environmentObject

Determines which environment we are currently in.

Default: ‘development’



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rack/sprocketize/config.rb', line 47

def environment
  if defined?(RAILS_ENV)
    RAILS_ENV # Rails 2
  elsif defined?(Rails) && defined?(Rails.env)
    Rails.env.to_s # Rails 3
  elsif ENV.key?('RACK_ENV')
    ENV['RACK_ENV']
  else
    'development'
  end
end