Class: Rack::Sprockets::Config

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

Overview

Handles configuration for Rack::Sprockets Available config settings: :cache

whether to cache the compilation output to
a corresponding static file. Also determines
what value config#combinations(:key) returns

:compress

Whether or not to apply compression to the
concatenation output - uses YUI Compressor
if available or will remove extraneous
whitespace if not.

Constant Summary collapse

ATTRIBUTES =
[:cache, :compress]
DEFAULTS =
{
  :cache    => false,
  :compress => false
}

Instance Method Summary collapse

Constructor Details

#initialize(settings = {}) ⇒ Config

Returns a new instance of Config.



25
26
27
28
29
# File 'lib/rack/sprockets/config.rb', line 25

def initialize(settings={})
  ATTRIBUTES.each do |a|
    instance_variable_set("@#{a}", settings[a] || DEFAULTS[a])
  end
end

Instance Method Details

#cache?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rack/sprockets/config.rb', line 31

def cache?
  !!@cache
end

#compress?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rack/sprockets/config.rb', line 35

def compress?
  !!@compress
end