Class: Yarrow::Content::Expansion::FilenameMap

Inherits:
Aggregator
  • Object
show all
Defined in:
lib/yarrow/content/expansion/filename_map.rb

Instance Attribute Summary

Attributes inherited from Aggregator

#graph

Instance Method Summary collapse

Methods inherited from Aggregator

#after_traversal, #before_traversal, #initialize

Constructor Details

This class inherits a constructor from Yarrow::Content::Expansion::Aggregator

Instance Method Details

#expand_directory(collection, policy) ⇒ Object



10
11
12
13
# File 'lib/yarrow/content/expansion/filename_map.rb', line 10

def expand_directory(collection, policy)
  create_collection(collection, policy.collection, policy.collection_const)
  @current_collection = collection.props[:path]
end

#expand_file(entity, policy) ⇒ Object



15
16
17
18
19
20
# File 'lib/yarrow/content/expansion/filename_map.rb', line 15

def expand_file(entity, policy)
  if policy.match_by_extension(entity.props[:ext])
    parent_path = entity.incoming(:directory).first.props[:path]
    create_resource(entity, parent_path, policy.entity, policy.entity_const)
  end
end

#expand_source(container, policy) ⇒ Object



5
6
7
8
# File 'lib/yarrow/content/expansion/filename_map.rb', line 5

def expand_source(container, policy)
  create_collection(container, policy.container, policy.container_const)
  @current_collection = container.props[:path]
end