Class: DeziDoc
- Inherits:
-
Object
- Object
- DeziDoc
- Defined in:
- lib/dezi/doc.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#mime_type ⇒ Object
Returns the value of attribute mime_type.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#score ⇒ Object
Returns the value of attribute score.
-
#size ⇒ Object
Returns the value of attribute size.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#title ⇒ Object
Returns the value of attribute title.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #as_string ⇒ Object
- #as_xml ⇒ Object
- #get_field(fname) ⇒ Object
-
#initialize(args) ⇒ DeziDoc
constructor
A new instance of DeziDoc.
- #set_field(args) ⇒ Object
Constructor Details
#initialize(args) ⇒ DeziDoc
Returns a new instance of DeziDoc.
38 39 40 41 |
# File 'lib/dezi/doc.rb', line 38 def initialize(args) @fields = {} args.each {|k,v| send("#{k}=",v)} end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
31 32 33 |
# File 'lib/dezi/doc.rb', line 31 def content @content end |
#fields ⇒ Object
Returns the value of attribute fields.
36 37 38 |
# File 'lib/dezi/doc.rb', line 36 def fields @fields end |
#mime_type ⇒ Object
Returns the value of attribute mime_type.
28 29 30 |
# File 'lib/dezi/doc.rb', line 28 def mime_type @mime_type end |
#mtime ⇒ Object
Returns the value of attribute mtime.
33 34 35 |
# File 'lib/dezi/doc.rb', line 33 def mtime @mtime end |
#score ⇒ Object
Returns the value of attribute score.
35 36 37 |
# File 'lib/dezi/doc.rb', line 35 def score @score end |
#size ⇒ Object
Returns the value of attribute size.
34 35 36 |
# File 'lib/dezi/doc.rb', line 34 def size @size end |
#summary ⇒ Object
Returns the value of attribute summary.
29 30 31 |
# File 'lib/dezi/doc.rb', line 29 def summary @summary end |
#title ⇒ Object
Returns the value of attribute title.
30 31 32 |
# File 'lib/dezi/doc.rb', line 30 def title @title end |
#uri ⇒ Object
Returns the value of attribute uri.
32 33 34 |
# File 'lib/dezi/doc.rb', line 32 def uri @uri end |
Instance Method Details
#as_string ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/dezi/doc.rb', line 56 def as_string() #puts "fields.length=" + @fields.length.to_s if @fields.length > 0 return self.as_xml() else return @content end end |
#as_xml ⇒ Object
65 66 67 |
# File 'lib/dezi/doc.rb', line 65 def as_xml() return XmlSimple.xml_out(@fields, {'rootname' => 'doc', 'noattr' => true}) end |
#get_field(fname) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/dezi/doc.rb', line 48 def get_field(fname) if @fields.has_key?(fname) return @fields[fname] else return nil end end |
#set_field(args) ⇒ Object
43 44 45 46 |
# File 'lib/dezi/doc.rb', line 43 def set_field(args) args.each {|k,v| @fields[k] = v} @mime_type = 'application/xml' end |