Class: DocxGenerator::DSL::Text
- Inherits:
-
Object
- Object
- DocxGenerator::DSL::Text
- Defined in:
- lib/docx_generator/dsl/text.rb
Instance Method Summary collapse
- #bold(value) ⇒ Object
- #generate ⇒ Object
-
#initialize(text_fragment, options = {}) {|_self| ... } ⇒ Text
constructor
A new instance of Text.
- #italics(value) ⇒ Object
- #size(value) ⇒ Object
- #subscript(value) ⇒ Object
- #superscript(value) ⇒ Object
- #to_s ⇒ Object
- #underline(value) ⇒ Object
Constructor Details
#initialize(text_fragment, options = {}) {|_self| ... } ⇒ Text
Returns a new instance of Text.
4 5 6 7 8 |
# File 'lib/docx_generator/dsl/text.rb', line 4 def initialize(text_fragment, = {}, &block) @text_fragment = text_fragment = yield self if block end |
Instance Method Details
#bold(value) ⇒ Object
10 11 12 |
# File 'lib/docx_generator/dsl/text.rb', line 10 def bold(value) [:bold] = value end |
#generate ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/docx_generator/dsl/text.rb', line 34 def generate = text = Word::Text.new({}, [@text_fragment]) if Word::Run.new({}, [, text]) else Word::Run.new({}, [text]) end end |
#italics(value) ⇒ Object
14 15 16 |
# File 'lib/docx_generator/dsl/text.rb', line 14 def italics(value) [:italics] = value end |
#size(value) ⇒ Object
22 23 24 |
# File 'lib/docx_generator/dsl/text.rb', line 22 def size(value) [:size] = value end |
#subscript(value) ⇒ Object
30 31 32 |
# File 'lib/docx_generator/dsl/text.rb', line 30 def subscript(value) [:subscript] = value end |
#superscript(value) ⇒ Object
26 27 28 |
# File 'lib/docx_generator/dsl/text.rb', line 26 def superscript(value) [:superscript] = value end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/docx_generator/dsl/text.rb', line 44 def to_s generate.to_s end |
#underline(value) ⇒ Object
18 19 20 |
# File 'lib/docx_generator/dsl/text.rb', line 18 def underline(value) [:underline] = value end |