Class: Stencil::ListCapsule
Instance Attribute Summary
Attributes inherited from Capsule
Instance Method Summary collapse
-
#initialize(render_class, &block) ⇒ ListCapsule
constructor
A new instance of ListCapsule.
- #map(&block) ⇒ Object
- #render(data) ⇒ Object
Constructor Details
#initialize(render_class, &block) ⇒ ListCapsule
Returns a new instance of ListCapsule.
72 73 74 75 |
# File 'lib/stencil/view.rb', line 72 def initialize(render_class, &block) super @mapping = nil end |
Instance Method Details
#map(&block) ⇒ Object
77 78 79 80 |
# File 'lib/stencil/view.rb', line 77 def map(&block) @mapping = ViewHost.sub_view(@render_class, &block) self end |
#render(data) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/stencil/view.rb', line 82 def render(data) list = super rendered = list.map do |item| @mapping.viewset(item) end rendered end |