File: asset_file.rb

package info (click to toggle)
ruby-inline-svg 1.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: ruby: 1,711; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 338 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
module InlineSvg
  class AssetFile
    class FileNotFound < IOError; end
    UNREADABLE_PATH = ''

    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
  end
end