Module: TeachingPrintables::QuadRulable
- Defined in:
- lib/teaching_printables/quad_rulable.rb
Overview
Creates quadrille rulings on paper. Delegates Prawn methods to Prawn::Document.
Instance Attribute Summary collapse
-
#rule_unit ⇒ Object
Make quadrille rules.
Instance Method Summary collapse
Instance Attribute Details
#rule_unit ⇒ Object
Make quadrille rules
9 10 11 |
# File 'lib/teaching_printables/quad_rulable.rb', line 9 def rule_unit @rule_unit end |
Instance Method Details
#create_quad_rule(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/teaching_printables/quad_rulable.rb', line 21 def create_quad_rule(={}) () puts rule_unit ncols = (rule_width.to_f/rule_unit).ceil nrows = (rule_height.to_f/rule_unit).ceil #Create svg grid with 10pxX10px unit square. #str = SVGComponents::header(@width,@height) str = SVGComponents::quad_ruled_grid(nrows,ncols) #str << SVGComponents::footer if (page_number ==0) || ([:start_new_page] == true) start_new_page end svg(str,width: ncols*rule_unit, height: nrows*rule_unit, at:[0,rule_height]) #position: :center, vposition: :center) end |
#rule_height ⇒ Object
14 15 16 |
# File 'lib/teaching_printables/quad_rulable.rb', line 14 def rule_height bounds.top - bounds.bottom end |
#rule_width ⇒ Object
17 18 19 |
# File 'lib/teaching_printables/quad_rulable.rb', line 17 def rule_width bounds.right - bounds.left end |