Class: BasicBlock::TextElement
- Inherits:
-
Object
- Object
- BasicBlock::TextElement
- Defined in:
- lib/relaton_iec/basic_block/text_element.rb
Constant Summary collapse
- TAGS =
%w[em strong sub sup tt underline strike smallcap br hr keyword rp rt ruby pagebreak bookmark].freeze
Instance Method Summary collapse
-
#initialize(tag:, content:) ⇒ TextElement
constructor
A new instance of TextElement.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(tag:, content:) ⇒ TextElement
Returns a new instance of TextElement.
11 12 13 14 15 16 17 |
# File 'lib/relaton_iec/basic_block/text_element.rb', line 11 def initialize(tag:, content:) unless TAGS.include? tag Util.warn "invalid tag `#{tag}`\nallowed tags are: `#{TAGS.join '`, `'}`" end @tag = tag @content = content end |
Instance Method Details
#to_xml(builder) ⇒ Object
20 21 22 23 24 |
# File 'lib/relaton_iec/basic_block/text_element.rb', line 20 def to_xml(builder) builder.send @tag do |b| @content.each { |c| c.is_a?(String) ? c : c.to_xml(b) } end end |