Class: InlineSvg::StaticAssetFinder
- Inherits:
-
Object
- Object
- InlineSvg::StaticAssetFinder
- Defined in:
- lib/inline_svg/static_asset_finder.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename) ⇒ StaticAssetFinder
constructor
A new instance of StaticAssetFinder.
- #pathname ⇒ Object
Constructor Details
#initialize(filename) ⇒ StaticAssetFinder
Returns a new instance of StaticAssetFinder.
13 14 15 |
# File 'lib/inline_svg/static_asset_finder.rb', line 13 def initialize(filename) @filename = filename end |
Class Method Details
.find_asset(filename) ⇒ Object
9 10 11 |
# File 'lib/inline_svg/static_asset_finder.rb', line 9 def self.find_asset(filename) new(filename) end |
Instance Method Details
#pathname ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/inline_svg/static_asset_finder.rb', line 17 def pathname if ::Rails.application.config.assets.compile asset = ::Rails.application.assets[@filename] Pathname.new(asset.filename) if asset.present? else manifest = ::Rails.application.assets_manifest asset_path = manifest.assets[@filename] unless asset_path.nil? ::Rails.root.join(manifest.directory, asset_path) end end end |