Class: MakeBook::Build
- Inherits:
-
Object
- Object
- MakeBook::Build
- Defined in:
- lib/makebook/build.rb
Overview
Build context
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
- #build(book) ⇒ Object
-
#initialize(out: nil) ⇒ Build
constructor
A new instance of Build.
Constructor Details
#initialize(out: nil) ⇒ Build
Returns a new instance of Build.
5 6 7 |
# File 'lib/makebook/build.rb', line 5 def initialize(out: nil) @root = Pathname.new(out || MakeBook::Build.default_root) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
3 4 5 |
# File 'lib/makebook/build.rb', line 3 def root @root end |
Class Method Details
.default_root ⇒ Object
24 25 26 |
# File 'lib/makebook/build.rb', line 24 def default_root Pathname.pwd + 'out' end |
Instance Method Details
#build(book) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/makebook/build.rb', line 9 def build(book) b = MakeBook::Book.new(book) b.formats.each do |format| format, = format.first if format.is_a? Hash ||= {} case format when 'html' then MakeBook::Formats::HTML.new(b, self, ).make when 'pdf' then MakeBook::Formats::PDF.new(b, self, ).make else raise NotImplementedError, format end end end |