Class: QDA::Document
Instance Attribute Summary collapse
-
#create_date ⇒ Object
readonly
Returns the value of attribute create_date.
-
#dbid ⇒ Object
Returns the value of attribute dbid.
-
#memo ⇒ Object
Returns the value of attribute memo.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#mod_date ⇒ Object
readonly
Returns the value of attribute mod_date.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Fragment
Instance Method Summary collapse
- #[](from, num_chars) ⇒ Object
-
#append(text, term_char = "\n") ⇒ Object
def append(text, fragtype = 0) returns the number of characters appended.
-
#create ⇒ Object
marks the document as created now.
-
#initialize(title, text = '', memo = '', create_date = Time.now(), mod_date = Time.now()) ⇒ Document
constructor
expects dbid to be set later.
- #inspect ⇒ Object
Methods inherited from Fragment
#==, #coerce, #complete?, #scan, #text, #to_code
Methods included from Coding
#<=>, #end, #exclude, #include?, #intersect, #overlap?, #prepare_args, #touch?, #union
Constructor Details
#initialize(title, text = '', memo = '', create_date = Time.now(), mod_date = Time.now()) ⇒ Document
expects dbid to be set later
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/weft/document.rb', line 90 def initialize( title, text = '', memo = '', create_date = Time.now(), mod_date = Time.now() ) super(text, title, 0) @title = title @memo = memo @create_date = create_date @mod_date = mod_date end |
Instance Attribute Details
#create_date ⇒ Object (readonly)
Returns the value of attribute create_date.
86 87 88 |
# File 'lib/weft/document.rb', line 86 def create_date @create_date end |
#dbid ⇒ Object
Returns the value of attribute dbid.
86 87 88 |
# File 'lib/weft/document.rb', line 86 def dbid @dbid end |
#memo ⇒ Object
Returns the value of attribute memo.
87 88 89 |
# File 'lib/weft/document.rb', line 87 def memo @memo end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
86 87 88 |
# File 'lib/weft/document.rb', line 86 def @meta end |
#mod_date ⇒ Object (readonly)
Returns the value of attribute mod_date.
86 87 88 |
# File 'lib/weft/document.rb', line 86 def mod_date @mod_date end |
#title ⇒ Object
Returns the value of attribute title.
87 88 89 |
# File 'lib/weft/document.rb', line 87 def title @title end |
Instance Method Details
#[](from, num_chars) ⇒ Object
122 123 124 |
# File 'lib/weft/document.rb', line 122 def [](from, num_chars) Fragment.new(super, title, from, @dbid) end |
#append(text, term_char = "\n") ⇒ Object
def append(text, fragtype = 0) returns the number of characters appended
116 117 118 119 120 |
# File 'lib/weft/document.rb', line 116 def append(text, term_char = "\n") ins = text.gsub(/[\r\n]+$/, '') + term_char self << ins ins.length end |
#create ⇒ Object
marks the document as created now
110 111 112 |
# File 'lib/weft/document.rb', line 110 def create() @create_date = Time.now() end |
#inspect ⇒ Object
126 127 128 |
# File 'lib/weft/document.rb', line 126 def inspect() "<*Document #{dbid} '#{title}' (#{length} chars)>" end |