Class: Rdomino::View

Inherits:
Object
  • Object
show all
Includes:
Enumerable, DcView, DomObject
Defined in:
lib/rdomino/view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DomObject

#empty?, #method_missing, #obj

Methods included from DcView

#each

Constructor Details

#initialize(db, name) ⇒ View

Returns a new instance of View.



7
8
9
10
11
12
13
14
# File 'lib/rdomino/view.rb', line 7

def initialize(db,name)
  if @obj = db.getView(name)
    unid = @obj.universalID 
    @document = Document.new(@obj.parent.getdocumentbyunid(unid))
  else
    @document = @obj = nil
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rdomino::DomObject

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



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

def document
  @document
end

Instance Method Details

#==(v) ⇒ Object



59
60
61
# File 'lib/rdomino/view.rb', line 59

def ==(v)
  title == v.title and comment == v.comment
end

#categoriesObject

first column of categorized view



17
18
19
20
21
22
23
24
25
26
# File 'lib/rdomino/view.rb', line 17

def categories
  nvn = @obj.CreateViewNav( 0 )
  r=[]
  nve = nvn.GetFirst
  while nve
    r << nve.ColumnValues
    nve = nvn.GetNextCategory(nve)  
  end
  r  
end

#commentObject



55
56
57
# File 'lib/rdomino/view.rb', line 55

def comment
  document.g :$comment
end

#get_all_documents_by_key(arg) ⇒ Object

def [](p)

  r = get_document_by_key(p)
  unless r.empty? 
    r
  end
end


42
43
44
# File 'lib/rdomino/view.rb', line 42

def get_all_documents_by_key(arg)
  DocumentCollection.new(@obj.getAllDocumentsByKey(arg))
end

#get_document_by_key(value, exact_match = true) ⇒ Object Also known as: []



28
29
30
31
# File 'lib/rdomino/view.rb', line 28

def get_document_by_key(value,exact_match=true)
  r = @obj.getDocumentByKey(value,exact_match)
  r ? Document.new(r) : r 
end

#refreshObject



46
47
48
49
# File 'lib/rdomino/view.rb', line 46

def refresh
  obj.Refresh
  self
end

#refresh_selection_formula(value) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/rdomino/view.rb', line 71

def refresh_selection_formula(value)
  unless @obj.SelectionFormula == value
    r = {}
    r[:old] = @obj.SelectionFormula
    r[:new] = value
    @obj.SelectionFormula= value
    r
  end
end

#select_after(time) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/rdomino/view.rb', line 63

def select_after(time)
  doc = getlastdocument
  while doc.created > time
    puts doc.created
    doc = getprevdocument(doc)
  end
end

#titleObject



51
52
53
# File 'lib/rdomino/view.rb', line 51

def title
  document.g :$Title
end

#to_arrayObject



81
82
83
84
85
# File 'lib/rdomino/view.rb', line 81

def to_array
  map{|doc|
    doc.columnvalues
  }
end