Class: WingedCouch::Queries::ViewBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/winged_couch/queries/view_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, model) ⇒ ViewBuilder


7
8
9
10
# File 'lib/winged_couch/queries/view_builder.rb', line 7

def initialize(view, model)
  @view = view
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model


5
6
7
# File 'lib/winged_couch/queries/view_builder.rb', line 5

def model
  @model
end

#viewObject (readonly)

Returns the value of attribute view


5
6
7
# File 'lib/winged_couch/queries/view_builder.rb', line 5

def view
  @view
end

Instance Method Details

#allObject


80
81
82
# File 'lib/winged_couch/queries/view_builder.rb', line 80

def all
  result
end

#countObject

.….….….….….….….….….….….….….


76
77
78
# File 'lib/winged_couch/queries/view_builder.rb', line 76

def count
  raw_result["total_rows"]
end

#descending(value) ⇒ Object

.….….….….….….….….….….….….….….….…


14
15
16
# File 'lib/winged_couch/queries/view_builder.rb', line 14

def descending(value)
  builder.with_param("descending", !!value); self
end

#endkey(value) ⇒ Object


18
19
20
# File 'lib/winged_couch/queries/view_builder.rb', line 18

def endkey(value)
  builder.with_param("endkey", value.inspect); self
end

#endkey_docid(value) ⇒ Object


22
23
24
# File 'lib/winged_couch/queries/view_builder.rb', line 22

def endkey_docid(value)
  builder.with_param("endkey_docid", value); self
end

#group(value) ⇒ Object


26
27
28
# File 'lib/winged_couch/queries/view_builder.rb', line 26

def group(value)
  builder.with_param("group", !!value); self
end

#group_level(value) ⇒ Object


30
31
32
# File 'lib/winged_couch/queries/view_builder.rb', line 30

def group_level(value)
  builder.with_param("group_level", value.to_i); self
end

#include_docs(value) ⇒ Object


34
35
36
# File 'lib/winged_couch/queries/view_builder.rb', line 34

def include_docs(value)
  builder.with_param("include_docs", !!value); self
end

#inclusive_end(value) ⇒ Object


38
39
40
# File 'lib/winged_couch/queries/view_builder.rb', line 38

def inclusive_end(value)
  builder.with_param("inclusive_end", !!value); self
end

#key(value) ⇒ Object


42
43
44
# File 'lib/winged_couch/queries/view_builder.rb', line 42

def key(value)
  builder.with_param("key", value.inspect); self  
end

#limit(value) ⇒ Object


46
47
48
# File 'lib/winged_couch/queries/view_builder.rb', line 46

def limit(value)
  builder.with_param("limit", value.to_i); self  
end

#paramsObject


88
89
90
# File 'lib/winged_couch/queries/view_builder.rb', line 88

def params
  builder.params
end

#pathObject


84
85
86
# File 'lib/winged_couch/queries/view_builder.rb', line 84

def path
  builder.path
end

#reduce(value) ⇒ Object


50
51
52
# File 'lib/winged_couch/queries/view_builder.rb', line 50

def reduce(value)
  builder.with_param("reduce", !!value); self  
end

#skip(value) ⇒ Object


54
55
56
# File 'lib/winged_couch/queries/view_builder.rb', line 54

def skip(value)
  builder.with_param("skip", value.to_i); self  
end

#stale(value) ⇒ Object


58
59
60
# File 'lib/winged_couch/queries/view_builder.rb', line 58

def stale(value)
  builder.with_param("stale", value); self  
end

#startkey(value) ⇒ Object


62
63
64
# File 'lib/winged_couch/queries/view_builder.rb', line 62

def startkey(value)
  builder.with_param("startkey", value.inspect); self  
end

#startkey_docid(value) ⇒ Object


66
67
68
# File 'lib/winged_couch/queries/view_builder.rb', line 66

def startkey_docid(value)
  builder.with_param("startkey_docid", value); self  
end

#update_seq(value) ⇒ Object


70
71
72
# File 'lib/winged_couch/queries/view_builder.rb', line 70

def update_seq(value)
  builder.with_param("update_seq", !!value); self
end