Class: PdfTempura::Document::BoxedCharacters::CharacterGroup
- Inherits:
-
Object
- Object
- PdfTempura::Document::BoxedCharacters::CharacterGroup
- Includes:
- Validation
- Defined in:
- lib/pdf_tempura/document/boxed_characters/groups.rb
Instance Attribute Summary collapse
-
#characters ⇒ Object
readonly
Returns the value of attribute characters.
Instance Method Summary collapse
- #each_supported_character(&block) ⇒ Object
-
#initialize(characters) ⇒ CharacterGroup
constructor
A new instance of CharacterGroup.
- #spacing ⇒ Object
- #width(box_width, spacing) ⇒ Object
Methods included from Validation
Constructor Details
#initialize(characters) ⇒ CharacterGroup
Returns a new instance of CharacterGroup.
9 10 11 12 |
# File 'lib/pdf_tempura/document/boxed_characters/groups.rb', line 9 def initialize(characters) @characters = characters validate! end |
Instance Attribute Details
#characters ⇒ Object (readonly)
Returns the value of attribute characters.
5 6 7 |
# File 'lib/pdf_tempura/document/boxed_characters/groups.rb', line 5 def characters @characters end |
Instance Method Details
#each_supported_character(&block) ⇒ Object
18 19 20 |
# File 'lib/pdf_tempura/document/boxed_characters/groups.rb', line 18 def each_supported_character(&block) characters.times{ yield } end |
#spacing ⇒ Object
14 15 16 |
# File 'lib/pdf_tempura/document/boxed_characters/groups.rb', line 14 def spacing 0 end |
#width(box_width, spacing) ⇒ Object
22 23 24 |
# File 'lib/pdf_tempura/document/boxed_characters/groups.rb', line 22 def width(box_width, spacing) box_width * characters + spacing * (characters - 1) end |