Sha256: 352e61dfae066da938b24c34bf7c292131ddf4883e512d924679c6012618d13b

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

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)
      entry.send(*args, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fakefs-3.0.0 lib/fakefs/fake/symlink.rb