Class: PureDocx::XmlGenerators::Text
- Defined in:
- lib/puredocx/xml_generators/text.rb
Constant Summary collapse
- DEFAULT_TEXT_SIZE =
28- DEFAULT_TEXT_ALIGN =
'left'.freeze
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#bold_enable ⇒ Object
readonly
Returns the value of attribute bold_enable.
-
#italic_enable ⇒ Object
readonly
Returns the value of attribute italic_enable.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(content, rels_constructor, arguments = {}) ⇒ Text
constructor
A new instance of Text.
- #params ⇒ Object
- #template ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(content, rels_constructor, arguments = {}) ⇒ Text
Returns a new instance of Text.
10 11 12 13 14 15 16 17 |
# File 'lib/puredocx/xml_generators/text.rb', line 10 def initialize(content, rels_constructor, arguments = {}) super(nil, rels_constructor) @content = CGI.escapeHTML(content) @bold_enable = [*arguments[:style]].include?(:bold) @italic_enable = [*arguments[:style]].include?(:italic) @align = arguments[:align] || DEFAULT_TEXT_ALIGN @size = arguments[:size] || DEFAULT_TEXT_SIZE end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
8 9 10 |
# File 'lib/puredocx/xml_generators/text.rb', line 8 def align @align end |
#bold_enable ⇒ Object (readonly)
Returns the value of attribute bold_enable.
8 9 10 |
# File 'lib/puredocx/xml_generators/text.rb', line 8 def bold_enable @bold_enable end |
#italic_enable ⇒ Object (readonly)
Returns the value of attribute italic_enable.
8 9 10 |
# File 'lib/puredocx/xml_generators/text.rb', line 8 def italic_enable @italic_enable end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/puredocx/xml_generators/text.rb', line 8 def size @size end |
Instance Method Details
#params ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/puredocx/xml_generators/text.rb', line 19 def params { '{TEXT}' => content, '{ALIGN}' => align, '{BOLD_ENABLE}' => bold_enable, '{ITALIC_ENABLE}' => italic_enable, '{SIZE}' => size } end |
#template ⇒ Object
29 30 31 |
# File 'lib/puredocx/xml_generators/text.rb', line 29 def template File.read(DocArchive.template_path('paragraph.xml')) end |