class Torba::ImportList
Represents a list of assets to be imported from a remote source.
Attributes
assets[R]
@return [Array<Asset>] full list of assets to be imported.
Public Class Methods
new(assets)
click to toggle source
# File lib/torba/import_list.rb, line 21 def initialize(assets) @assets = assets end
Public Instance Methods
css_assets()
click to toggle source
@return [Array<Asset>] list of stylesheets to be imported.
# File lib/torba/import_list.rb, line 33 def css_assets assets.find_all { |asset| asset.css? } end
find_by_absolute_path(path)
click to toggle source
@return [Asset] asset with given path. @param path [String] absolute path of an asset. @raise [Errors::AssetNotFound] if nothing found
# 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()
click to toggle source
@return [Array<Asset>] list of assets to be imported except stylesheets.
# File lib/torba/import_list.rb, line 38 def non_css_assets assets.find_all { |asset| !asset.css? } end
non_js_css_assets()
click to toggle source
@return [Array<Asset>] list of assets to be imported except javascripts and
stylesheets.
@since 0.3.0
# File lib/torba/import_list.rb, line 45 def non_js_css_assets assets.find_all { |asset| !(asset.js? || asset.css?) } end