Class: IRODS4r::File

Inherits:
Object
  • Object
show all
Defined in:
lib/irods4r/file.rb

Overview

This class proxies a file in an iRODS environment

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



46
47
48
# File 'lib/irods4r/file.rb', line 46

def path
  @path
end

Class Method Details

.create(path, must_not_exist = true, opts = {}) ⇒ Object

Create a file resource ‘path’. If ‘must_not_exist’ is true, throw exception if resource already exists.



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

def self.create(path, must_not_exist = true, opts = {})
  if must_not_exist
    raise FileExistsException.new(path) if ICommands.exist?(path)
  end
  self.new(path, opts)
end

Instance Method Details

#directory?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/irods4r/file.rb', line 42

def directory?
  return false
end

#file?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/irods4r/file.rb', line 38

def file?
  return true
end

#readObject

Return the content of this file



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

def read()
  ICommands.read(@path)
end

#write(content) ⇒ Object

Write content to this file.

WARN: This will overwrite any previous content



34
35
36
# File 'lib/irods4r/file.rb', line 34

def write(content)
  ICommands.write(@path, content)
end