Method: JsFiles#initialize

Defined in:
lib/sinatra/support/compressedjs.rb

#initialize(options = {}) ⇒ JsFiles

Creates a JsFiles object based on the list of given files.

Examples:


files  = Dir['public/js/jquery.*.js']
$js_files = JsFiles.new(files)

Parameters:

  • files (Array)

    A list of string file paths.



176
177
178
179
180
181
182
183
184
185
# File 'lib/sinatra/support/compressedjs.rb', line 176

def initialize(options={})
  @app    = options[:app]
  @files  = options[:files]
  @prefix = options[:prefix] || '/js/'
  @path   = options[:path] || @prefix + 'app.js'
  @root   = options[:root] || '/app/js'
  @root   = File.expand_path(@root)

  raise "Files must be an array"  unless @files.is_a?(Array)
end