Class: Slippery::Presentation
- Inherits:
-
Object
- Object
- Slippery::Presentation
- Includes:
- Hexp
- Defined in:
- lib/slippery/presentation.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ type: :reveal_js, history: true }.freeze
Instance Method Summary collapse
-
#initialize(document, options = {}) ⇒ Presentation
constructor
A new instance of Presentation.
- #js_options ⇒ Object
- #processors ⇒ Object
- #to_hexp ⇒ Object
Constructor Details
#initialize(document, options = {}) ⇒ Presentation
Returns a new instance of Presentation.
10 11 12 13 |
# File 'lib/slippery/presentation.rb', line 10 def initialize(document, = {}) @document = document @options = DEFAULT_OPTIONS.merge().freeze end |
Instance Method Details
#js_options ⇒ Object
43 44 45 |
# File 'lib/slippery/presentation.rb', line 43 def @options.reject { |key, _| [:type].include? key } end |
#processors ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/slippery/presentation.rb', line 15 def processors { impress_js: [ Processors::HrToSections.new(H[:div, class: 'step']), Processors::ImpressJs::AddImpressJs.new(), (Processors::ImpressJs::AutoOffsets.new unless @options.fetch(:manual_offsets, false)), ].compact, reveal_js: [ Processors::HrToSections.new(H[:section]), Processors::RevealJs::AddRevealJs.new(), ], fathom_js: [ Processors::HrToSections.new(H[:div, class: 'slide']), Processors::JQuery.new(), Processors::FathomJs.new(), ], deck_js: [ Processors::HrToSections.new(H[:section, class: 'slide']), Processors::JQuery.new(), Processors::DeckJs.new(), ], shower: [ Processors::HrToSections.new(H[:section, class: 'slide']), Processors::Shower.new(), ] }[@options[:type]] end |
#to_hexp ⇒ Object
47 48 49 |
# File 'lib/slippery/presentation.rb', line 47 def to_hexp @document.process(*processors) end |