Sha256: 44a7e897337cec0705180d5e01063de04cfc12da5e0d351a032cce2be5ca4849

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

= General Usage of Folio Link Object

Require the Folio library.

  require 'folio'

Instantiate a soft link.

  @foo = Folio.file('fixtures/foo_softlink.txt')

It is a link.

  @foo.link?.assert == true

It is equal to a link defined identically.

  @foo.assert == Folio.file('fixtures/foo_softlink.txt')

The link is not equal to the target document.

  @foo.assert! == Folio.file('fixtures/foo.txt')

But it is equal to a same link instantiated from a differnt working directory.

  f = nil
  Dir.chdir('fixtures') do
    f = Folio.file('foo_softlink.txt')
  end
  @foo.assert == f

Reads the linked document correctly.

  @foo.read == "THIS IS FOO!"

Opens the linked document for reading.

  t = nil
  @foo.open('r'){ |f| t = f.read }
  t.assert == "THIS IS FOO!\n"

It provides the parent directory object.

  @foo.parent.assert == Folio.dir('fixtures')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
folio-0.4.0 spec/link/general.rd