Module: IRODS4r

Defined in:
lib/irods4r.rb,
lib/irods4r/file.rb,
lib/irods4r/directory.rb,
lib/irods4r/icommands.rb

Defined Under Namespace

Modules: ICommands Classes: Directory, File, FileEnumerator, FileExistsException, IRODS4rException, NoDirectoryException, NoFileException, NotFoundException

Class Method Summary collapse

Class Method Details

.exists?(path, ticket = nil) ⇒ Boolean

Return true if ‘path’ exists

Returns:

  • (Boolean)


26
27
28
# File 'lib/irods4r.rb', line 26

def self.exists?(path, ticket = nil)
  ICommands.exist?(path, ticket)
end

.find(irodsPath = ".", opts = {}, ticket = nil) ⇒ Directory|File

Return a IRODS4r object for ‘irodsPath’ if it exists.

Parameters:

  • irodsPath (String) (defaults to: ".")

    Absolute path into iRODS

  • opts (Hash) (defaults to: {})

    Options to use for establishing context

Returns:



15
16
17
18
19
20
21
22
23
# File 'lib/irods4r.rb', line 15

def self.find(irodsPath = ".", opts = {}, ticket = nil)
  r = ICommands.ls(irodsPath, ticket)
  name = r.to_a[0].strip
  if name.end_with? ':'
    Directory.new(name[0 ... -1])
  else
    File.new(name)
  end
end