Class: ODDB::Text::Chapter

Inherits:
Object
  • Object
show all
Includes:
OddbUri
Defined in:
lib/oddb/export/yaml.rb,
lib/oddb/text/chapter.rb

Constant Summary

Constants included from OddbUri

OddbUri::YAML_URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OddbUri

#to_yaml, #to_yaml_map, #to_yaml_type

Constructor Details

#initialize(name) ⇒ Chapter

Returns a new instance of Chapter.



8
9
10
11
# File 'lib/oddb/text/chapter.rb', line 8

def initialize(name)
  @name = name
  @paragraphs = []
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/oddb/text/chapter.rb', line 7

def name
  @name
end

#paragraphsObject (readonly)

Returns the value of attribute paragraphs.



7
8
9
# File 'lib/oddb/text/chapter.rb', line 7

def paragraphs
  @paragraphs
end

Instance Method Details

#add_paragraph(paragraph) ⇒ Object



12
13
14
# File 'lib/oddb/text/chapter.rb', line 12

def add_paragraph(paragraph)
  @paragraphs.push paragraph unless paragraph.empty?
end

#append(chapter) ⇒ Object



15
16
17
# File 'lib/oddb/text/chapter.rb', line 15

def append(chapter)
  @paragraphs.concat chapter.paragraphs
end

#to_sObject



18
19
20
# File 'lib/oddb/text/chapter.rb', line 18

def to_s
  @paragraphs.join("\n")
end