Class: ODDB::Text::Chapter
- Inherits:
-
Object
- Object
- ODDB::Text::Chapter
- Includes:
- OddbUri
- Defined in:
- lib/oddb/export/yaml.rb,
lib/oddb/text/chapter.rb
Constant Summary
Constants included from OddbUri
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#paragraphs ⇒ Object
readonly
Returns the value of attribute paragraphs.
Instance Method Summary collapse
- #add_paragraph(paragraph) ⇒ Object
- #append(chapter) ⇒ Object
-
#initialize(name) ⇒ Chapter
constructor
A new instance of Chapter.
- #to_s ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/oddb/text/chapter.rb', line 7 def name @name end |
#paragraphs ⇒ Object (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_s ⇒ Object
18 19 20 |
# File 'lib/oddb/text/chapter.rb', line 18 def to_s @paragraphs.join("\n") end |