Sha256: cfa438c837802ee1d7e3fd40e886f3108a2458fb40fd20d84593cb0fdda9b363

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 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)
      pathname.parent_pathname.find(location)
    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

2 entries across 2 versions & 1 rubygems

Version Path
sstephenson-sprockets-0.3.0 lib/sprockets/source_file.rb
sstephenson-sprockets-0.4.0 lib/sprockets/source_file.rb