class InlineSvg::StaticAssetFinder

Public Class Methods

find_asset(filename) click to toggle source
# File lib/inline_svg/static_asset_finder.rb, line 9
def self.find_asset(filename)
  new(filename)
end
new(filename) click to toggle source
# File lib/inline_svg/static_asset_finder.rb, line 13
def initialize(filename)
  @filename = filename
end

Public Instance Methods

pathname() click to toggle source
# 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