Class: Syaso::List
Constant Summary collapse
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#each(options = {}, &block) ⇒ Object
render container and iterate items.
-
#initialize(context, content) ⇒ List
constructor
initialize instance.
-
#render(options = {}, &block) ⇒ Object
render list.
Constructor Details
#initialize(context, content) ⇒ List
initialize instance
16 17 18 19 |
# File 'lib/syaso/list.rb', line 16 def initialize(context, content) super(context) self.content = content end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Syaso::Base
Instance Method Details
#each(options = {}, &block) ⇒ Object
render container and iterate items
36 37 38 39 40 41 42 43 |
# File 'lib/syaso/list.rb', line 36 def each( = {}, &block) self._render() do |i| self.content.each do |i| yield(self.item_view(i)) end "" end end |
#render(options = {}, &block) ⇒ Object
render list
24 25 26 27 28 29 30 31 |
# File 'lib/syaso/list.rb', line 24 def render( = {}, &block) ops = .delete(:item)||{} self.each() do |i| self.buffer do i.render(ops, &block) end end end |