Class: Prawn::SwissQRBill::DebugSection
- Inherits:
-
Object
- Object
- Prawn::SwissQRBill::DebugSection
- Defined in:
- lib/prawn/swiss_qr_bill/debug_section.rb
Overview
Draws a blue debug section.
Reference: www.paymentstandards.ch/dam/downloads/style-guide-en.pdf
OPTIMIZE: move several general styling functions to helpers (bb-helper)
Constant Summary collapse
- SECTIONS =
[ 'receipt', 'receipt.title', 'receipt.information', 'receipt.amount', 'receipt.acceptance', 'payment', 'payment.title', 'payment.information', 'payment.qr_code', 'payment.qr_cross', 'payment.amount', 'payment.further_information' ].freeze
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(document) ⇒ DebugSection
constructor
A new instance of DebugSection.
Constructor Details
#initialize(document) ⇒ DebugSection
Returns a new instance of DebugSection.
29 30 31 32 33 34 35 |
# File 'lib/prawn/swiss_qr_bill/debug_section.rb', line 29 def initialize(document) @doc = document @brain = { font: {}, border: { color: nil, width: nil } } @spec = Prawn::SwissQRBill::Specifications.new end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
27 28 29 |
# File 'lib/prawn/swiss_qr_bill/debug_section.rb', line 27 def doc @doc end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
27 28 29 |
# File 'lib/prawn/swiss_qr_bill/debug_section.rb', line 27 def properties @properties end |
Instance Method Details
#draw ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/prawn/swiss_qr_bill/debug_section.rb', line 37 def draw SECTIONS.each do |section| name = @spec.get(section)['name'] specs = @spec.get_specs(section) point = specs.point = { width: specs.width, height: specs.height }.merge( text: name, background: false, border: true, font_size: 10 ) draw_debug_box(point, ) end end |