Class: InlineSvg::AssetFile

Inherits:
Object
  • Object
show all
Defined in:
lib/inline_svg/asset_file.rb

Defined Under Namespace

Classes: FileNotFound

Constant Summary collapse

UNREADABLE_PATH =
''

Class Method Summary collapse

Class Method Details

.named(filename) ⇒ Object



6
7
8
9
10
11
# File 'lib/inline_svg/asset_file.rb', line 6

def self.named(filename)
  asset_path = FindsAssetPaths.by_filename(filename)
  File.read(asset_path || UNREADABLE_PATH)
rescue Errno::ENOENT
  raise FileNotFound.new("Asset not found: #{asset_path}")
end