class Pinion::BundleType
A ‘BundleType` is a description of how to bundle together multiple assets of the same type. New types of `Bundle`s may be created with `BundleType.create`. A particular bundle type is simply a Proc that knows how to bundle together a set of assets. For convenience, there is a built-in `BundleType` type already defined, `:concatenate_and_uglify_js`.
Public Class Methods
[](name)
click to toggle source
Retrieve a ‘BundleType` by name.
# File lib/pinion/bundle_type.rb, line 25 def self.[](name) @@bundle_types[name] end
create(name, &block)
click to toggle source
Create a new bundle definition. The block will be called with argument ‘assets`, the array of `Asset`s.
-
assets: an array of ‘Asset`s
# File lib/pinion/bundle_type.rb, line 20 def self.create(name, &block) @@bundle_types[name] = BundleType.new(block) end
new(definition_proc)
click to toggle source
# File lib/pinion/bundle_type.rb, line 9 def initialize(definition_proc) @definition_proc = definition_proc end
Public Instance Methods
process(assets)
click to toggle source
Process an array of ‘Asset`s to produce the bundled result.
# File lib/pinion/bundle_type.rb, line 14 def process(assets) @definition_proc.call(assets) end