Sha256: c47f64fd28fc7bdb8d0ef6cbeea4b3f2a953754fa5cc1debc32091602c0f67b7

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

module FakeFS
  class FakeSymlink
    attr_accessor :name, :target, :parent

    def initialize(target)
      @target = target
    end

    def inspect
      "symlink(#{name} -> #{target.split('/').last})"
    end

    def entry
      FileSystem.find(target)
    end

    def delete
      parent.delete(self)
    end

    def to_s
      File.join(parent.to_s, name)
    end

    def respond_to?(method)
      entry.respond_to?(method)
    end

  private

    def method_missing(*args, &block)
      entry.send(*args, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fakefs-0.5.2 lib/fakefs/fake/symlink.rb
fakefs-0.5.1 lib/fakefs/fake/symlink.rb
fakefs-0.5.0 lib/fakefs/fake/symlink.rb