Class: Coradoc::Document::Title

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/document/title.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, level, options = {}) ⇒ Title

Returns a new instance of Title.



6
7
8
9
10
11
# File 'lib/coradoc/document/title.rb', line 6

def initialize(content, level, options = {})
  @level_str = level
  @content = content.to_s
  @id = options.fetch(:id, nil).to_s
  @line_break = options.fetch(:line_break, "")
end

Instance Attribute Details

#contentObject (readonly) Also known as: text

Returns the value of attribute content.



4
5
6
# File 'lib/coradoc/document/title.rb', line 4

def content
  @content
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/coradoc/document/title.rb', line 4

def id
  @id
end

#line_breakObject (readonly)

Returns the value of attribute line_break.



4
5
6
# File 'lib/coradoc/document/title.rb', line 4

def line_break
  @line_break
end

Instance Method Details

#levelObject



13
14
15
# File 'lib/coradoc/document/title.rb', line 13

def level
  @level ||= level_from_string
end