Class: PdfTempura::Render::BoxedCharacters
- Inherits:
-
Object
- Object
- PdfTempura::Render::BoxedCharacters
- Includes:
- FieldBounds, OptionAccess
- Defined in:
- lib/pdf_tempura/render/boxed_characters.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(field, value, options = {}) ⇒ BoxedCharacters
constructor
A new instance of BoxedCharacters.
- #render(pdf) ⇒ Object
Constructor Details
#initialize(field, value, options = {}) ⇒ BoxedCharacters
Returns a new instance of BoxedCharacters.
9 10 11 12 13 14 15 |
# File 'lib/pdf_tempura/render/boxed_characters.rb', line 9 def initialize(field, value, = {}) @field = field = @value = value ? value.dup : "" validate_value_length! end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
7 8 9 |
# File 'lib/pdf_tempura/render/boxed_characters.rb', line 7 def field @field end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/pdf_tempura/render/boxed_characters.rb', line 7 def value @value end |
Instance Method Details
#render(pdf) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pdf_tempura/render/boxed_characters.rb', line 17 def render(pdf) characters = value.chars.to_a field.fields.each do |field| break if characters.empty? Field::generate(field, characters.shift, ).render(pdf) end render_debug_annotation(pdf) if draw_outlines? end |