Class: Marksmith::Configuration::RedcarpetOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/marksmith/configuration.rb

Constant Summary collapse

DEFAULTS =
{
  tables: true,
  lax_spacing: true,
  fenced_code_blocks: true,
  space_after_headers: true,
  hard_wrap: true,
  autolink: true,
  strikethrough: true,
  underline: true,
  highlight: true,
  quote: true,
  with_toc_data: true
}.freeze

Class Method Summary collapse

Class Method Details

.merge(options) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/marksmith/configuration.rb', line 22

def self.merge(options)
  options.to_h.each do |key, value|
    writer = "#{key}="

    unless respond_to?(writer)
      raise ArgumentError, "Unknown Redcarpet option: #{key}"
    end

    public_send(writer, value)
  end

  self
end

.to_hObject



36
37
38
39
40
# File 'lib/marksmith/configuration.rb', line 36

def self.to_h
  DEFAULTS.keys.each_with_object({}) do |key, hash|
    hash[key] = public_send(key)
  end
end