File: file_reader.rb

package info (click to toggle)
ruby-sprockets 3.7.0-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 544 kB
  • sloc: ruby: 4,163; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'set'

module Sprockets
  # Internal: The first processor in the pipeline that reads the file into
  # memory and passes it along as `input[:data]`.  
  class FileReader
    def self.call(input)
      env = input[:environment]
      data = env.read_file(input[:filename], input[:content_type])
      dependencies = Set.new(input[:metadata][:dependencies])
      dependencies += [env.build_file_digest_uri(input[:filename])]
      { data: data, dependencies: dependencies }
    end
  end
end