Class: Coradoc::Element::Block::Core
- Inherits:
-
Object
- Object
- Coradoc::Element::Block::Core
- Defined in:
- lib/coradoc/element/block/core.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #gen_anchor ⇒ Object
- #gen_attributes ⇒ Object
- #gen_delimiter ⇒ Object
- #gen_lines ⇒ Object
- #gen_title ⇒ Object
-
#initialize(title, options = {}) ⇒ Core
constructor
A new instance of Core.
- #type ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ Core
Returns a new instance of Core.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/coradoc/element/block/core.rb', line 9 def initialize(title, = {}) @title = title @lines = .fetch(:lines, []) @type_str = .fetch(:type, nil) @delimiter = .fetch(:delimiter, "") @attributes = .fetch(:attributes, {}) @lang = .fetch(:lang, nil) @id = .fetch(:id, nil) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def id @id end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def lang @lang end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def lines @lines end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def title @title end |
Instance Method Details
#gen_anchor ⇒ Object
24 25 26 |
# File 'lib/coradoc/element/block/core.rb', line 24 def gen_anchor @anchor.nil? ? "" : "#{@anchor.to_adoc}\n" end |
#gen_attributes ⇒ Object
34 35 36 |
# File 'lib/coradoc/element/block/core.rb', line 34 def gen_attributes @attributes.nil? ? "" : "#{@attributes.to_adoc}\n" end |
#gen_delimiter ⇒ Object
38 39 40 |
# File 'lib/coradoc/element/block/core.rb', line 38 def gen_delimiter @delimiter_char * @delimiter_len end |
#gen_lines ⇒ Object
42 43 44 |
# File 'lib/coradoc/element/block/core.rb', line 42 def gen_lines Coradoc::Generator.gen_adoc(@lines) end |
#gen_title ⇒ Object
28 29 30 31 32 |
# File 'lib/coradoc/element/block/core.rb', line 28 def gen_title t = Coradoc::Generator.gen_adoc(@title) return "" if t.empty? ".#{t}\n" end |
#type ⇒ Object
20 21 22 |
# File 'lib/coradoc/element/block/core.rb', line 20 def type @type ||= defined_type || type_from_delimiter end |