Class: Torba::ImportList
- Inherits:
-
Object
- Object
- Torba::ImportList
- Defined in:
- lib/torba/import_list.rb
Overview
Represents a list of assets to be imported from a remote source.
Defined Under Namespace
Classes: Asset
Instance Attribute Summary collapse
-
#assets ⇒ Array<Asset>
readonly
Full list of assets to be imported.
Instance Method Summary collapse
-
#css_assets ⇒ Array<Asset>
List of stylesheets to be imported.
-
#find_by_absolute_path(path) ⇒ Asset
Asset with given path.
-
#initialize(assets) ⇒ ImportList
constructor
A new instance of ImportList.
-
#non_css_assets ⇒ Array<Asset>
List of assets to be imported except stylesheets.
-
#non_js_css_assets ⇒ Array<Asset>
List of assets to be imported except javascripts and stylesheets.
Constructor Details
#initialize(assets) ⇒ ImportList
Returns a new instance of ImportList.
21 22 23 |
# File 'lib/torba/import_list.rb', line 21 def initialize(assets) @assets = assets end |
Instance Attribute Details
#assets ⇒ Array<Asset> (readonly)
Returns full list of assets to be imported.
19 20 21 |
# File 'lib/torba/import_list.rb', line 19 def assets @assets end |
Instance Method Details
#css_assets ⇒ Array<Asset>
Returns list of stylesheets to be imported.
33 34 35 |
# File 'lib/torba/import_list.rb', line 33 def css_assets assets.find_all { |asset| asset.css? } end |
#find_by_absolute_path(path) ⇒ Asset
Returns asset with given path.
28 29 30 |
# File 'lib/torba/import_list.rb', line 28 def find_by_absolute_path(path) assets.find { |asset| asset.absolute_path == path } || raise(Errors::AssetNotFound.new(path)) end |
#non_css_assets ⇒ Array<Asset>
Returns list of assets to be imported except stylesheets.
38 39 40 |
# File 'lib/torba/import_list.rb', line 38 def non_css_assets assets.find_all { |asset| !asset.css? } end |
#non_js_css_assets ⇒ Array<Asset>
Returns list of assets to be imported except javascripts and stylesheets.
45 46 47 |
# File 'lib/torba/import_list.rb', line 45 def non_js_css_assets assets.find_all { |asset| !(asset.js? || asset.css?) } end |