Class: Skyrocket::AssetLocator
- Inherits:
-
Object
- Object
- Skyrocket::AssetLocator
- Defined in:
- lib/skyrocket/asset_locator.rb
Instance Method Summary collapse
- #all_assets ⇒ Object
-
#initialize(asset_factory) ⇒ AssetLocator
constructor
A new instance of AssetLocator.
- #missing_asset_paths ⇒ Object
Constructor Details
#initialize(asset_factory) ⇒ AssetLocator
Returns a new instance of AssetLocator.
5 6 7 |
# File 'lib/skyrocket/asset_locator.rb', line 5 def initialize(asset_factory) @af = asset_factory end |
Instance Method Details
#all_assets ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/skyrocket/asset_locator.rb', line 9 def all_assets dirs = @af.asset_dirs paths = Array.new dirs.each do |dir| paths += Dir.glob_files(dir + "/**/*") end paths.map{ |p| @af.build_asset(p) } end |
#missing_asset_paths ⇒ Object
18 19 20 21 22 23 |
# File 'lib/skyrocket/asset_locator.rb', line 18 def missing_asset_paths out_cont = Dir.glob_files(@af.output_dir + "/**/*") assets = all_assets a_m = all_assets.inject(Hash.new) { |h, a| h[a.output_path] = a; h } out_cont.select { |file| !a_m.keys.include?(file) } end |