Class: BistroCar::Bundle

Inherits:
Object
  • Object
show all
Defined in:
lib/bistro_car/bundle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Bundle

Returns a new instance of Bundle.



5
6
7
# File 'lib/bistro_car/bundle.rb', line 5

def initialize(name)
  @name = name.to_sym
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/bistro_car/bundle.rb', line 3

def name
  @name
end

Instance Method Details

#file_pathsObject



9
10
11
# File 'lib/bistro_car/bundle.rb', line 9

def file_paths
  Dir.glob(path.join('*.coffee')).to_a
end

#javascript_urlObject



17
18
19
# File 'lib/bistro_car/bundle.rb', line 17

def javascript_url
  "/javascripts/bundle/#{name}.js"
end

#to_javascriptObject



13
14
15
# File 'lib/bistro_car/bundle.rb', line 13

def to_javascript
  minify(file_paths.map { |path| BistroCar.compile(File.read(path)) }.join)
end