Class: CouchPotato::View::BaseViewSpec
- Inherits:
-
Object
- Object
- CouchPotato::View::BaseViewSpec
- Defined in:
- lib/couch_potato/view/base_view_spec.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#design_document ⇒ Object
readonly
Returns the value of attribute design_document.
-
#list_function ⇒ Object
readonly
Returns the value of attribute list_function.
-
#list_name ⇒ Object
readonly
Returns the value of attribute list_name.
-
#reduce_function ⇒ Object
readonly
Returns the value of attribute reduce_function.
-
#view_name ⇒ Object
readonly
Returns the value of attribute view_name.
-
#view_parameters ⇒ Object
readonly
Returns the value of attribute view_parameters.
Instance Method Summary collapse
-
#initialize(klass, view_name, options, view_parameters) ⇒ BaseViewSpec
constructor
A new instance of BaseViewSpec.
- #process_results(results) ⇒ Object
Constructor Details
#initialize(klass, view_name, options, view_parameters) ⇒ BaseViewSpec
Returns a new instance of BaseViewSpec.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 7 def initialize(klass, view_name, , view_parameters) normalized_view_parameters = normalize_view_parameters view_parameters @list_name = normalized_view_parameters.delete(:list) || [:list] assert_valid_view_parameters normalized_view_parameters @klass = klass # If there is a specified design name generator, we use that one @design_document = CouchPotato.design_name_fun.call klass @view_name = view_name @options = @list_function = klass.lists(@list_name) if @list_name @view_parameters = {} [:group, :include_docs, :descending, :group_level, :limit].each do |key| @view_parameters[key] = [key] if .include?(key) end @view_parameters.merge!(normalized_view_parameters) end |
Instance Attribute Details
#design_document ⇒ Object (readonly)
Returns the value of attribute design_document.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def design_document @design_document end |
#list_function ⇒ Object (readonly)
Returns the value of attribute list_function.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def list_function @list_function end |
#list_name ⇒ Object (readonly)
Returns the value of attribute list_name.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def list_name @list_name end |
#reduce_function ⇒ Object (readonly)
Returns the value of attribute reduce_function.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def reduce_function @reduce_function end |
#view_name ⇒ Object (readonly)
Returns the value of attribute view_name.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def view_name @view_name end |
#view_parameters ⇒ Object (readonly)
Returns the value of attribute view_parameters.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def view_parameters @view_parameters end |
Instance Method Details
#process_results(results) ⇒ Object
27 28 29 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 27 def process_results(results) results end |