Class: Bookify::Node::List
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#clean_html, #font, #html_classes, #initialize, #method_missing, render
Constructor Details
This class inherits a constructor from Bookify::Node::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bookify::Node::Base
Instance Method Details
#bullet(index) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/bookify/node/list.rb', line 21 def bullet(index) if node.name == "ul" "•" # is there a better way to render this? else "#{index + 1}." end end |
#render ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bookify/node/list.rb', line 3 def render font :primary move_up 5 data = node.css("li").each_with_index.map do |li, i| [bullet(i), li.inner_html.strip] end table(data) do cells.inline_format = true cells.borders = [] cells.padding = 5 end move_down 5 end |