Class: Recliner::ViewGenerator
- Extended by:
- ActiveSupport::Memoizable
- Defined in:
- lib/recliner/views/generator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(options = {}) ⇒ ViewGenerator
constructor
A new instance of ViewGenerator.
Constructor Details
#initialize(options = {}) ⇒ ViewGenerator
Returns a new instance of ViewGenerator.
7 8 9 |
# File 'lib/recliner/views/generator.rb', line 7 def initialize(={}) @options = { :conditions! => {}, :order => :_id }.merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/recliner/views/generator.rb', line 5 def @options end |
Instance Method Details
#generate ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/recliner/views/generator.rb', line 11 def generate map = "" map << "if (#{conditions}) {\n" unless conditions.blank? map << " emit(#{key}, #{value});\n" map << "}\n" unless conditions.blank? [ViewFunction::Map.new(map), nil] end |