Sha256: e7f2d7d229a88476ddf8fe08064cc6aebaa3ec39f59a65bb9d88970f8be602bb

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents

module Sprockets
  class SourceFile
    attr_reader :environment, :pathname

    def initialize(environment, pathname)
      @environment = environment
      @pathname = pathname
    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
      Time.now
    end
    
    def each_line
      File.open(pathname.absolute_location) do |file|
        file.each_line do |line|
          yield line, file.lineno
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sprockets-foo-0.0.4 ext/sprockets_with_directives/lib/sprockets/source_file.rb
sprockets-foo-0.0.3 ext/sprockets_with_directives/lib/sprockets/source_file.rb
sprockets-foo-0.0.2 ext/sprockets_with_directives/lib/sprockets/source_file.rb