Sha256: e16805fe9e4f4573177263da37afc12e438810a54a35ad54b7cd12356309e012

Contents?: true

Size: 532 Bytes

Versions: 4

Compression:

Stored size: 532 Bytes

Contents

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

    def initialize(target)
      @target = target
    end

    def inspect
      "symlink(#{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

4 entries across 4 versions & 1 rubygems

Version Path
fakefs-0.4.3 lib/fakefs/fake/symlink.rb
fakefs-0.4.2 lib/fakefs/fake/symlink.rb
fakefs-0.4.1 lib/fakefs/fake/symlink.rb
fakefs-0.4.0 lib/fakefs/fake/symlink.rb