class Jasmine::AssetExpander

Public Class Methods

new(bundled_asset_factory, asset_path_for) click to toggle source
# 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

Public Instance Methods

expand(src_dir, src_path) click to toggle source
# File lib/jasmine/asset_expander.rb, line 8
def expand(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