Module: Trackman::Assets::CompositeAsset
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#asset_from(virtual, physical) ⇒ Object
19 20 21 |
# File 'lib/trackman/assets/composite_asset.rb', line 19 def asset_from(virtual, physical) Asset.create(:virtual_path => virtual, :path => physical) end |
#assets ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/trackman/assets/composite_asset.rb', line 11 def assets internals = children_paths.select{|p| p.internal_path? }.map{|p| {:old => p, :new_path => translate(p, path)} } internals = internals.select{|p| !p[:new_path].nil? }.map{|p| asset_from(p[:old], p[:new_path])} internals.inject([]) do |sum, a| (sum << a) + a.assets.select{|child| !sum.include?(child) } end end |