Class: Coradoc::Element::Block::Open
- Inherits:
-
Core
- Object
- Coradoc::Element::Base
- Core
- Coradoc::Element::Block::Open
- Defined in:
- lib/coradoc/element/block/open.rb
Instance Attribute Summary
Attributes inherited from Core
#attributes, #id, #lang, #lines, #title
Instance Method Summary collapse
-
#initialize(title, options = {}) ⇒ Open
constructor
A new instance of Open.
- #to_adoc ⇒ Object
Methods inherited from Core
#gen_anchor, #gen_attributes, #gen_delimiter, #gen_lines, #gen_title, #type
Methods inherited from Coradoc::Element::Base
access_children, #children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(title, options = {}) ⇒ Open
Returns a new instance of Open.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/coradoc/element/block/open.rb', line 5 def initialize(title, = {}) @title = title @id = .fetch(:id, nil) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) @lang = .fetch(:lang, "") @attributes = .fetch(:attributes, AttributeList.new) @lines = .fetch(:lines, []) @delimiter_char = "-" @delimiter_len = .fetch(:delimiter_len, 2) end |
Instance Method Details
#to_adoc ⇒ Object
16 17 18 |
# File 'lib/coradoc/element/block/open.rb', line 16 def to_adoc "\n\n#{gen_anchor}#{gen_attributes}#{gen_delimiter}\n" << gen_lines << "\n#{gen_delimiter}\n\n" end |