Class: InlineSvg::WebpackAssetFinder
- Inherits:
-
Object
- Object
- InlineSvg::WebpackAssetFinder
- Defined in:
- lib/inline_svg/webpack_asset_finder.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename) ⇒ WebpackAssetFinder
constructor
A new instance of WebpackAssetFinder.
- #pathname ⇒ Object
Constructor Details
#initialize(filename) ⇒ WebpackAssetFinder
Returns a new instance of WebpackAssetFinder.
7 8 9 10 11 |
# File 'lib/inline_svg/webpack_asset_finder.rb', line 7 def initialize(filename) @filename = filename manifest_lookup = asset_helper.manifest.lookup(@filename) @asset_path = manifest_lookup.present? ? URI(manifest_lookup).path : "" end |
Class Method Details
.find_asset(filename) ⇒ Object
3 4 5 |
# File 'lib/inline_svg/webpack_asset_finder.rb', line 3 def self.find_asset(filename) new(filename) end |
Instance Method Details
#pathname ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/inline_svg/webpack_asset_finder.rb', line 13 def pathname return if @asset_path.blank? if asset_helper.dev_server.running? dev_server_asset(@asset_path) elsif asset_helper.config.public_path.present? File.join(asset_helper.config.public_path, @asset_path) end end |