Class: Jasmine::AssetExpander
- Inherits:
-
Object
- Object
- Jasmine::AssetExpander
- Defined in:
- lib/jasmine/asset_expander.rb
Instance Method Summary collapse
- #expand(src_dir, src_path) ⇒ Object
-
#initialize(bundled_asset_factory, asset_path_for) ⇒ AssetExpander
constructor
A new instance of AssetExpander.
Constructor Details
#initialize(bundled_asset_factory, asset_path_for) ⇒ AssetExpander
Returns a new instance of AssetExpander.
3 4 5 6 |
# File 'lib/jasmine/asset_expander.rb', line 3 def initialize(bundled_asset_factory, asset_path_for) @bundled_asset_factory = bundled_asset_factory @asset_path_for = asset_path_for end |
Instance Method Details
#expand(src_dir, src_path) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/jasmine/asset_expander.rb', line 8 def (src_dir, src_path) pathname = src_path.gsub(/^\/?assets\//, '').gsub(/\.js$/, '') bundled_asset = @bundled_asset_factory.call(pathname, 'js') return nil unless bundled_asset bundled_asset.to_a.map do |asset| "/#{@asset_path_for.call(asset).gsub(/^\//, '')}?body=true" end.flatten end |