Module: Aperitiiif::Assets
- Included in:
- Batch
- Defined in:
- lib/aperitiiif/batch/assets.rb
Overview
TO DO COMMENT
Instance Method Summary collapse
- #asset_map(dir = config.source_dir) ⇒ Object
- #assets ⇒ Object
- #child_assets(path) ⇒ Object
-
#map_to_assets(mymap = asset_map) ⇒ Object
has smell :reek:NestedIterators.
Instance Method Details
#asset_map(dir = config.source_dir) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/aperitiiif/batch/assets.rb', line 23 def asset_map(dir = config.source_dir) map = {} Dir["#{dir}/*"].each do |path| parent_id = Utils.parent_id(path, dir) children = child_assets path map[parent_id] = children unless children.empty? end map end |
#assets ⇒ Object
7 8 9 |
# File 'lib/aperitiiif/batch/assets.rb', line 7 def assets @assets ||= map_to_assets end |
#child_assets(path) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/aperitiiif/batch/assets.rb', line 11 def child_assets(path) return [path] if Utils.valid_source?(path) return [] unless File.directory? path Dir.glob("#{path}/*").select { |sub| Utils.valid_source? sub } end |