Class: ReVIEW::Book::Part
- Includes:
- Compilable, TOCRoot
- Defined in:
- lib/review/book/part.rb,
lib/review/tocparser.rb
Instance Attribute Summary collapse
-
#chapters ⇒ Object
readonly
Returns the value of attribute chapters.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Attributes included from Compilable
Instance Method Summary collapse
- #each_chapter(&block) ⇒ Object
- #file? ⇒ Boolean
-
#initialize(book, number, chapters, name = "") ⇒ Part
constructor
A new instance of Part.
- #volume ⇒ Object
Methods included from TOCRoot
#chapter?, #each_section, #each_section_with_index, #estimated_lines, #level, #n_sections
Methods included from Compilable
#basename, #bibpaper, #bibpaper_index, #content, #dirname, #env, #footnote, #footnote_index, #headline, #headline_index, #icon_index, #image, #image_index, #indepimage_index, #lines, #list, #list_index, #numberless_image_index, #open, #size, #table, #table_index, #title
Methods included from TextUtils
#convert_inencoding, #convert_outencoding, #detab, #split_paragraph
Constructor Details
#initialize(book, number, chapters, name = "") ⇒ Part
Returns a new instance of Part.
18 19 20 21 22 23 24 |
# File 'lib/review/book/part.rb', line 18 def initialize(book, number, chapters, name="") @book = book @number = number @chapters = chapters @path = name @name = name ? File.basename(name, '.*') : nil end |
Instance Attribute Details
#chapters ⇒ Object (readonly)
Returns the value of attribute chapters.
27 28 29 |
# File 'lib/review/book/part.rb', line 27 def chapters @chapters end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/review/book/part.rb', line 28 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
26 27 28 |
# File 'lib/review/book/part.rb', line 26 def number @number end |
Instance Method Details
#each_chapter(&block) ⇒ Object
30 31 32 |
# File 'lib/review/book/part.rb', line 30 def each_chapter(&block) @chapters.each(&block) end |
#file? ⇒ Boolean
38 39 40 |
# File 'lib/review/book/part.rb', line 38 def file? (name.present? and path =~ /\.re\z/) ? true : false end |