Class: Rdomino::DocumentCollection
- Inherits:
-
Object
- Object
- Rdomino::DocumentCollection
show all
- Includes:
- Enumerable, DbDcDoc, DcView, DomObject
- Defined in:
- lib/rdomino/document_collection.rb
Instance Method Summary
collapse
Methods included from DomObject
#empty?, #method_missing, #obj
Methods included from DcView
#each
Methods included from DbDcDoc
#dxl, #dxl_to_file
Constructor Details
Returns a new instance of DocumentCollection.
5
6
7
|
# File 'lib/rdomino/document_collection.rb', line 5
def initialize(o)
@obj = o
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Rdomino::DomObject
Instance Method Details
#each_limit(limit = 2) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/rdomino/document_collection.rb', line 26
def each_limit(limit=2)
each_with_index do |doc,index|
break if index >= limit
yield doc
end
end
|
#first ⇒ Object
9
10
11
|
# File 'lib/rdomino/document_collection.rb', line 9
def first
Document.new(@obj.getfirstdocument )
end
|
#last ⇒ Object
13
14
15
|
# File 'lib/rdomino/document_collection.rb', line 13
def last
Document.new(@obj.getlastdocument )
end
|
#update_attributes(hash) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/rdomino/document_collection.rb', line 17
def update_attributes( hash )
message = hash.map { |k,v| "FIELD #{k}:=#{v}"}.join("; ")
if obj.count == 0
0
elsif ask("Should I stamp #{obj.count} Documents in #{obj.parent.title} () ? (y/n)") == "y"
update_attributes!( hash )
end
end
|
#update_attributes!(hash) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/rdomino/document_collection.rb', line 33
def update_attributes!( hash )
hash.each do |k,v|
obj.stampall(k.to_s, v )
end
obj.count
end
|