Class: Document
- Inherits:
-
Object
- Object
- Document
- Defined in:
- lib/document.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(client, hash, colname) ⇒ Document
constructor
A new instance of Document.
- #to_s ⇒ Object
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
#group ⇒ Object (readonly)
Returns the value of attribute group.
6 7 8 |
# File 'lib/document.rb', line 6 def group @group end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/document.rb', line 4 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
5 6 7 |
# File 'lib/document.rb', line 5 def owner @owner end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/document.rb', line 3 def path @path end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
7 8 9 |
# File 'lib/document.rb', line 7 def @permissions end |
Instance Method Details
#content ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/document.rb', line 25 def content = { "indent" => "yes", "encoding" => "UTF-8", "expand-xincludes" => "yes" } return @client.call("getDocument", @path, ) rescue XMLRPC::FaultException => e raise e rescue raise ExistException.new("Failed to load content of Document", 11), callers end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/document.rb', line 21 def to_s return "#{@permissions} #{@owner} #{@group} #{@name}" end |