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.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#lib ⇒ Object
readonly
Returns the value of attribute lib.
-
#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
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.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 9 def initialize(klass, view_name, , view_parameters) normalized_view_parameters = normalize_view_parameters view_parameters @list_name = normalized_view_parameters.delete(:list) || [:list] @language = [:language] || Config.default_language assert_valid_view_parameters normalized_view_parameters assert_sorted_false_not_with_startkey_endkey normalized_view_parameters @klass = klass @options = @view_name = compute_view_name(view_name, .key?(:digest_view_name) ? [:digest_view_name] : Config.digest_view_names) @design_document = translate_to_design_doc_name(klass.to_s, @view_name, @list_name) @list_params = normalized_view_parameters.delete :list_params @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) @view_parameters.merge!(@list_params) if @list_params 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 |
#language ⇒ Object (readonly)
Returns the value of attribute language.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def language @language end |
#lib ⇒ Object (readonly)
Returns the value of attribute lib.
4 5 6 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 4 def lib @lib 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
Returns the value of attribute view_parameters.
5 6 7 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 5 def view_parameters @view_parameters end |
Instance Method Details
#process_results(results) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/couch_potato/view/base_view_spec.rb', line 33 def process_results(results) if (filter = [:results_filter]) filter.call results else results end end |