Class: Bookify::Node::List
Constant Summary collapse
- PADDING =
3
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#break_if_close_to_bottom, #clean_html, #decode_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
25 26 27 28 29 30 31 |
# File 'lib/bookify/node/list.rb', line 25 def bullet(index) if node.name == "ul" "•" # is there a better way to render this? else "#{index + 1}." end end |
#render ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bookify/node/list.rb', line 7 def render font :primary move_up PADDING data = node.css("li").each_with_index.map { |li, i| [bullet(i), li.inner_html.strip] } table(data) do cells.inline_format = true cells.borders = [] cells.padding = PADDING end move_down 10 end |