Module: Rack::Sprockets::Options::ClassMethods

Defined in:
lib/rack/sprockets/options.rb

Instance Method Summary collapse

Instance Method Details

#defaultsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rack/sprockets/options.rb', line 37

def defaults
  {
    option_name(:root)         => ".",
    option_name(:public)       => 'public',
    option_name(:source)       => 'app/javascripts',
    option_name(:hosted_at)    => '/javascripts',
    option_name(:load_path)    => [
      "app/javascripts/",
      "vendor/javascripts/"
    ],
    option_name(:expand_paths) => true
  }
end

#option_name(key) ⇒ Object

Rack::Sprockets uses the Rack Environment to store option values. All options are stored in the Rack Environment as “<RACK_ENV_PREFIX>.<option>”, where <option> is the option name.



54
55
56
57
58
59
60
# File 'lib/rack/sprockets/options.rb', line 54

def option_name(key)
  case key
  when Symbol ; "#{RACK_ENV_NS}.#{key}"
  when String ; key
  else raise ArgumentError
  end
end