Sha256: 953d493716f46f494381b920f6cbdda30b603e5b13da8ac3007c18697767cdd3

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'folio/fileobject'

module Folio

  class Link < FileObject

    def initialize(path)
      super
      raise FileNotFound unless ::File.symlink?(@path)

      @folio = Folio.new(::File.readlink(path))
    end

    #--
    # Am I write to think any file object can be linked?
    #++

    def symlink?
      ::File.symlink(path)
    end

    def link?
      ::File.link?(path)
    end
    
    def readlink
      ::File.readlink(path)
    end

    def lchmod(mode)
      ::File.lchmod(mode, path)
    end

    def lchown(own, grp)
      ::File.lchown(own, grp, path)
    end

    def lstat
      ::File.lstat(path)
    end

    #    
    def method_missing(s, *a, &b)
      @folio.send(s, *a, &b)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
folio-0.1.0 lib/folio/link.rb
folio-0.2.0 lib/folio/link.rb