Class: CabezaDeTermo::Assets::Collector
- Inherits:
-
Object
- Object
- CabezaDeTermo::Assets::Collector
- Defined in:
- lib/cabeza-de-termo/assets/collectors/collector.rb
Overview
This object collects the assets from both an included asset and the assets included by a required bundle.
Instance Method Summary collapse
-
#assets ⇒ Object
Answer the collected assets.
-
#bundle_named(bundle_name) ⇒ Object
Answer the bundle named bundle_name.
-
#include(asset) ⇒ Object
Add the asset to the collected assets.
-
#initialize ⇒ Collector
constructor
Initialize the instance.
-
#require(bundle_name) ⇒ Object
Add the assets included in the bundle named bundle_name.
Constructor Details
#initialize ⇒ Collector
Initialize the instance
8 9 10 |
# File 'lib/cabeza-de-termo/assets/collectors/collector.rb', line 8 def initialize @assets = [] end |
Instance Method Details
#assets ⇒ Object
Answer the collected assets. The answer is a collection of strings.
13 14 15 |
# File 'lib/cabeza-de-termo/assets/collectors/collector.rb', line 13 def assets @assets end |
#bundle_named(bundle_name) ⇒ Object
Answer the bundle named bundle_name.
31 32 33 |
# File 'lib/cabeza-de-termo/assets/collectors/collector.rb', line 31 def bundle_named(bundle_name) Library.bundle_named bundle_name end |
#include(asset) ⇒ Object
Add the asset to the collected assets. Ignore the asset if it was already included.
19 20 21 22 |
# File 'lib/cabeza-de-termo/assets/collectors/collector.rb', line 19 def include(asset) return if @assets.include?(asset) @assets << asset end |
#require(bundle_name) ⇒ Object
Add the assets included in the bundle named bundle_name.
25 26 27 28 |
# File 'lib/cabeza-de-termo/assets/collectors/collector.rb', line 25 def require(bundle_name) bundle_named(bundle_name) .collect_assets_with(self) end |