Class: Makimono::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/makimono/configuration.rb

Constant Summary collapse

DEFAULTS =
{
  # Makimono
  source: File.expand_path('src'),
  output: File.expand_path('out'),
  style: nil,
  template: 'default.xhtml',
  markdown: 'CommonMarker',
  converters: %w[Markdown],
  generator: 'EPUB',
  ebook_file_name: 'book',
  library: File.expand_path('lib'),

  # EPUB
  identifier: "urn:uuid:#{SecureRandom.uuid}",
  title: 'No title',
  language: 'ja'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Configuration

Returns a new instance of Configuration.



32
33
34
# File 'lib/makimono/configuration.rb', line 32

def initialize(config = {})
  @config = DEFAULTS.merge(config)
end

Instance Method Details

#styleObject



40
41
42
43
44
45
46
47
48
# File 'lib/makimono/configuration.rb', line 40

def style
  return @style if defined? @style

  @style = if @config[:style].nil? || @config[:style].empty?
             nil
           else
             Style.from_style_config(@config[:style])
           end
end

#to_hObject



36
37
38
# File 'lib/makimono/configuration.rb', line 36

def to_h
  @config
end