Class: Recycle::List
- Inherits:
- BasicObject
- Defined in:
- lib/recycle/list.rb
Constant Summary collapse
- TMPL =
"<%= \"=\" * 80 %>\n<%= title.center(80).rstrip %>\n<%= \"=\" * 80 %>\n<% sorted_content.each do |content| %>\n<%= render_row(key_width, content.first, content.last) -%>\n<% end %>\n\n".freeze
Class Method Summary collapse
Class Method Details
.render_section(title, content) ⇒ Object
16 17 18 19 20 |
# File 'lib/recycle/list.rb', line 16 def render_section(title, content) key_width = content.keys.map(&:length).max sorted_content = content.sort_by { |key, _value| key } ::ERB.new(TMPL, nil, '-').result(binding) end |