Sha256: f26cf76816db650461f15d38d3c7ad1fd34728a21f34a5b8e0daac552a95e48b

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

module Sprockets
  class SourceFile
    attr_reader :environment, :pathname

    def initialize(environment, pathname)
      @environment = environment
      @pathname = pathname
    end
    
    def each_source_line
      File.open(pathname.absolute_location) do |file|
        file.each do |line|
          yield SourceLine.new(self, line, file.lineno)
        end
      end
    end
    
    def find(location, kind = :file)
      pathname.parent_pathname.find(location, kind)
    end
    
    def ==(source_file)
      pathname == source_file.pathname
    end
    
    def mtime
      File.mtime(pathname.absolute_location)
    rescue Errno::ENOENT
      0
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sstephenson-sprockets-0.5.0 lib/sprockets/source_file.rb
sstephenson-sprockets-0.9.0 lib/sprockets/source_file.rb
sprockets-0.9.0 lib/sprockets/source_file.rb