class Slippery::Presentation

Constants

DEFAULT_OPTIONS

Public Class Methods

new(document, options = {}) click to toggle source
# File lib/slippery/presentation.rb, line 10
def initialize(document, options = {})
  @document = document
  @options = DEFAULT_OPTIONS.merge(options).freeze
end

Public Instance Methods

js_options() click to toggle source
# File lib/slippery/presentation.rb, line 39
def js_options
  @options.reject { |key, _| [:type].include? key }
end
processors() click to toggle source
# File lib/slippery/presentation.rb, line 15
def processors
  {
    impress_js: [
      Processors::HrToSections.new(H[:div, class: 'step']),
      Processors::ImpressJs::AddImpressJs.new(js_options),
      (Processors::ImpressJs::AutoOffsets.new unless @options.fetch(:manual_offsets, false)),
    ].compact,
    reveal_js: [
      Processors::HrToSections.new(H[:section]),
      Processors::RevealJs::AddRevealJs.new(js_options),
    ],
    fathom_js: [
      Processors::HrToSections.new(H[:div, class: 'slide']),
      Processors::JQuery.new(js_options),
      Processors::FathomJs.new(js_options),
    ],
    deck_js: [
      Processors::HrToSections.new(H[:section, class: 'slide']),
      Processors::JQuery.new(js_options),
      Processors::DeckJs.new(js_options),
    ]
  }[@options[:type]]
end
to_hexp() click to toggle source
# File lib/slippery/presentation.rb, line 43
def to_hexp
  @document.process(*processors)
end