lib/rpub/book.rb in rpub-0.2.1 vs lib/rpub/book.rb in rpub-0.3.0
- old
+ new
@@ -9,26 +9,28 @@
delegate_to_hash :config
# @return [Hash] The hash of configuration options read from the config.yml file.
attr_reader :config
- # @return [Array] List of chapters, one for every input markdown file.
+ # @return [Array<Chapter>] List of chapters, one for every input markdown file.
attr_reader :chapters
+ # @return [Array<String>] all the fonts referred to in the stylesheet
+ attr_reader :fonts
+
# @return [String] the path the layout HTML file to use to wrap the chapter in.
attr_reader :layout
- def initialize(layout, config = {})
- @chapters, @config, @layout = [], config, layout
+ def initialize(layout, config = {}, fonts = [])
+ @chapters, @config, @layout, @fonts = [], config, layout, fonts
end
def each(&block)
chapters.each(&block)
end
def has_fonts?
- fonts = config.fetch('fonts') { [] }
- fonts.respond_to?(:any?) && fonts.any?
+ fonts.any?
end
def has_toc?
!!config.fetch('toc') { false }
end