Sha256: 81b3dec7725745387b119fdc813e708bc461b310ab6777c6540ef67d0cb4dcd9

Contents?: true

Size: 941 Bytes

Versions: 58

Compression:

Stored size: 941 Bytes

Contents

module Sprockets
  class Pathname
    attr_reader :environment, :absolute_location
    
    def initialize(environment, absolute_location)
      @environment = environment
      @absolute_location = File.expand_path(absolute_location)
    end

    # Returns a Pathname for the location relative to this pathname's absolute location.
    def find(location, kind = :file)
      location = File.join(absolute_location, location)
      File.send("#{kind}?", location) ? Pathname.new(environment, location) : nil
    end

    def parent_pathname
      Pathname.new(environment, File.dirname(absolute_location))
    end

    def source_file
      SourceFile.new(environment, self)
    end
    
    def contents
      IO.read(absolute_location)
    end
    
    def ==(pathname)
      environment == pathname.environment &&
        absolute_location == pathname.absolute_location
    end
    
    def to_s
      absolute_location
    end
  end
end

Version data entries

58 entries across 57 versions & 7 rubygems

Version Path
sprockets-foo-0.0.3 ext/sprockets_with_directives/lib/sprockets/pathname.rb
sprockets-foo-0.0.2 ext/sprockets_with_directives/lib/sprockets/pathname.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.10.17 vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.10.16 vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.10.15 vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
middleman-0.10.14 vendor/gems/gems/sprockets-1.0.2/lib/sprockets/pathname.rb
sprockets-0.9.0 lib/sprockets/pathname.rb
sprockets-1.0.2 lib/sprockets/pathname.rb
sprockets-1.0.0 lib/sprockets/pathname.rb
sprockets-0.9.1 lib/sprockets/pathname.rb
sprockets-1.0.1 lib/sprockets/pathname.rb