Class: RelaxDB::View
- Inherits:
-
Object
- Object
- RelaxDB::View
- Defined in:
- lib/relaxdb/views.rb
Instance Attribute Summary collapse
-
#view_name ⇒ Object
readonly
Returns the value of attribute view_name.
Class Method Summary collapse
- .design_doc ⇒ Object
-
.reset ⇒ Object
A convenience for tests that create their own views.
Instance Method Summary collapse
- #add_to_design_doc ⇒ Object
-
#initialize(view_name, map_func, reduce_func = nil) ⇒ View
constructor
A new instance of View.
Constructor Details
#initialize(view_name, map_func, reduce_func = nil) ⇒ View
Returns a new instance of View.
57 58 59 60 61 |
# File 'lib/relaxdb/views.rb', line 57 def initialize view_name, map_func, reduce_func = nil @view_name = view_name @map_func = map_func @reduce_func = reduce_func end |
Instance Attribute Details
#view_name ⇒ Object (readonly)
Returns the value of attribute view_name.
55 56 57 |
# File 'lib/relaxdb/views.rb', line 55 def view_name @view_name end |
Class Method Details
.design_doc ⇒ Object
63 64 65 |
# File 'lib/relaxdb/views.rb', line 63 def self.design_doc @design_doc ||= DesignDocument.get(RelaxDB.dd) end |
.reset ⇒ Object
A convenience for tests that create their own views
70 71 72 |
# File 'lib/relaxdb/views.rb', line 70 def self.reset @design_doc = nil end |
Instance Method Details
#add_to_design_doc ⇒ Object
74 75 76 77 78 |
# File 'lib/relaxdb/views.rb', line 74 def add_to_design_doc dd = View.design_doc dd.add_map_view(@view_name, @map_func) dd.add_reduce_view(@view_name, @reduce_func) if @reduce_func end |