Class: Makimono::Configuration

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

Constant Summary collapse

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

  # EPUB
  identifier: "urn:uuid:#{SecureRandom.uuid}",
  modified: Time.now,
  title: 'No title',
  language: 'ja',
  creator: nil,
  contributor: nil,
  date: nil,
  page_progression_direction: nil
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Configuration

Returns a new instance of Configuration.



41
42
43
# File 'lib/makimono/configuration.rb', line 41

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

Instance Method Details

#styleObject



49
50
51
52
53
54
55
56
57
# File 'lib/makimono/configuration.rb', line 49

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



45
46
47
# File 'lib/makimono/configuration.rb', line 45

def to_h
  @config
end