class Slippery::Processors::ImpressJs::AddImpressJs

Constants

DEFAULT_ATTRS

Attributes

attributes[R]

Public Class Methods

call(doc) click to toggle source
# File lib/slippery/processors/impress_js/add_impress_js.rb, line 7
def self.call(doc)
  self.new.call(doc)
end
new(attributes = {}) click to toggle source
# File lib/slippery/processors/impress_js/add_impress_js.rb, line 17
def initialize(attributes = {})
  @attributes = DEFAULT_ATTRS.merge(attributes).freeze
end

Public Instance Methods

call(doc) click to toggle source
# File lib/slippery/processors/impress_js/add_impress_js.rb, line 21
def call(doc)
  doc.replace('body') do |body|
    include_local_javascript(body, 'impress.js/js/impress.js')
      .set_attrs({id: 'impress'}.merge(data_attributes(attributes)))
      .add H[:script, 'impress().init();']
  end
end