Class: MakeBook::Chapter
- Inherits:
-
Object
- Object
- MakeBook::Chapter
- Defined in:
- lib/makebook/chapter.rb
Overview
A book chapter
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(file = nil, book: nil, name: nil) ⇒ Chapter
constructor
A new instance of Chapter.
- #root ⇒ Object
Constructor Details
#initialize(file = nil, book: nil, name: nil) ⇒ Chapter
Returns a new instance of Chapter.
5 6 7 8 |
# File 'lib/makebook/chapter.rb', line 5 def initialize(file = nil, book: nil, name: nil) file ||= book.root + "#{name}.md" @source = Pathname.new(file) end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/makebook/chapter.rb', line 3 def source @source end |
Instance Method Details
#root ⇒ Object
10 11 12 |
# File 'lib/makebook/chapter.rb', line 10 def root source.dirname end |