Class: Document

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, hash, colname) ⇒ Document

Returns a new instance of Document.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/document.rb', line 9

def initialize(client, hash, colname)
  @client = client
  @path = colname + hash['name']
  @name = @path[/[^\/]+$/]
  #puts "filename #{@name}"
  @owner = hash['owner']
  @group = hash['group']
  @permissions = hash['permissions']
rescue  => e
  raise e  
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



6
7
8
# File 'lib/document.rb', line 6

def group
  @group
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/document.rb', line 4

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



5
6
7
# File 'lib/document.rb', line 5

def owner
  @owner
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/document.rb', line 3

def path
  @path
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



7
8
9
# File 'lib/document.rb', line 7

def permissions
  @permissions
end

Instance Method Details

#contentObject



25
26
27
28
29
30
31
32
33
# File 'lib/document.rb', line 25

def content
  options = { "indent" => "yes", "encoding" => "UTF-8",
    "expand-xincludes" => "yes" }
  return @client.call("getDocument", @path, options)
rescue XMLRPC::FaultException => e
  raise e
rescue
  raise ExistException.new("Failed to load content of Document", 11), callers
end

#to_sObject



21
22
23
# File 'lib/document.rb', line 21

def to_s
  return "#{@permissions} #{@owner} #{@group} #{@name}"
end