Class: Mascot::DirectoryCollection
- Inherits:
-
Object
- Object
- Mascot::DirectoryCollection
- Defined in:
- lib/mascot/directory_collection.rb
Overview
Maps a directory of assets into a set of routes that correspond with the ‘path` root.
Instance Attribute Summary collapse
-
#assets ⇒ Object
readonly
Returns the value of attribute assets.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path:, assets:) ⇒ DirectoryCollection
constructor
A new instance of DirectoryCollection.
- #mount(node) ⇒ Object
Constructor Details
#initialize(path:, assets:) ⇒ DirectoryCollection
Returns a new instance of DirectoryCollection.
7 8 9 10 |
# File 'lib/mascot/directory_collection.rb', line 7 def initialize(path: , assets:) @path = path @assets = assets end |
Instance Attribute Details
#assets ⇒ Object (readonly)
Returns the value of attribute assets.
5 6 7 |
# File 'lib/mascot/directory_collection.rb', line 5 def assets @assets end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/mascot/directory_collection.rb', line 5 def path @path end |
Instance Method Details
#mount(node) ⇒ Object
12 13 14 |
# File 'lib/mascot/directory_collection.rb', line 12 def mount(node) assets.each { |a| node.add path: asset_path_to_request_path(a), asset: a } end |