Class: Aureus::Components::Listing
- Inherits:
-
Renderable
- Object
- Renderable
- Aureus::Components::Listing
- Defined in:
- lib/aureus/components/listing.rb
Instance Method Summary collapse
- #entry(head, body = nil, &block) ⇒ Object
-
#initialize {|_self| ... } ⇒ Listing
constructor
A new instance of Listing.
- #render ⇒ Object
Methods inherited from Renderable
#compact, #compact_render, #content_tag, #init
Constructor Details
#initialize {|_self| ... } ⇒ Listing
Returns a new instance of Listing.
4 5 6 7 |
# File 'lib/aureus/components/listing.rb', line 4 def initialize @entries = Array.new yield(self) end |
Instance Method Details
#entry(head, body = nil, &block) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/aureus/components/listing.rb', line 9 def entry(head, body = nil, &block) init_haml_helpers if block_given? @entries << ListingEntry.new(head, capture_haml(&block)) else @entries << ListingEntry.new(head, body) end end |
#render ⇒ Object
18 19 20 |
# File 'lib/aureus/components/listing.rb', line 18 def render content_tag 'table', compact_render(*@entries), class: 'aureus-simple-table' end |