Sha256: 1259317c18274d78b5e83f4613a22c0f28f455c2d6c7c789e08c7e6e38e93026

Contents?: true

Size: 697 Bytes

Versions: 41

Compression:

Stored size: 697 Bytes

Contents

module FakeFS
  # Fake symlink class
  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(File.expand_path(target.to_s, parent.to_s))
    end

    def delete
      parent.delete(self)
    end

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

    def respond_to_missing?(method, include_private = false)
      entry.respond_to?(method, include_private)
    end

    private

    def method_missing(*args, &block) # rubocop:disable Style/MethodMissingSuper
      entry.send(*args, &block)
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
fakefs-2.8.0 lib/fakefs/fake/symlink.rb
fakefs-2.7.1 lib/fakefs/fake/symlink.rb
fakefs-2.7.0 lib/fakefs/fake/symlink.rb
fakefs-2.6.0 lib/fakefs/fake/symlink.rb
fakefs-2.5.0 lib/fakefs/fake/symlink.rb
fakefs-2.4.0 lib/fakefs/fake/symlink.rb
fakefs-2.3.0 lib/fakefs/fake/symlink.rb
fakefs-2.2.0 lib/fakefs/fake/symlink.rb
fakefs-2.1.0 lib/fakefs/fake/symlink.rb
fakefs-2.0.0 lib/fakefs/fake/symlink.rb
fakefs-1.9.0 lib/fakefs/fake/symlink.rb
fakefs-1.8.0 lib/fakefs/fake/symlink.rb
fakefs-1.7.0 lib/fakefs/fake/symlink.rb
fakefs-1.6.0 lib/fakefs/fake/symlink.rb
fakefs-1.5.1 lib/fakefs/fake/symlink.rb
fakefs-1.5.0 lib/fakefs/fake/symlink.rb
fakefs-1.4.1 lib/fakefs/fake/symlink.rb
fakefs-1.4.0 lib/fakefs/fake/symlink.rb
fakefs-1.3.2 lib/fakefs/fake/symlink.rb
fakefs-1.3.1 lib/fakefs/fake/symlink.rb