Sha256: 6c3b22df624af93452e8b3081cf2fbbc0715e930fbebd54563673098c2de3d5b

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

module Slippery
  module Processors
    module ImpressJs
     class AddImpressJs
       include ProcessorHelpers

       def self.call(doc)
         self.new.call(doc)
       end

       attr_reader :attributes

       DEFAULT_ATTRS = {
        'transition-duration' => 1000
      }.freeze

       def initialize(attributes = {})
         @attributes    = DEFAULT_ATTRS.merge(attributes).freeze
       end

       def call(doc)
         doc.replace('body') do |body|
           include_local_javascript(body, asset_uri('impress.js/js/impress.js'))
             .set_attrs({id: 'impress'}.merge(data_attributes(attributes)))
             .add H[:script, 'impress().init();']
         end
       end
     end
   end
 end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slippery-0.3.0 lib/slippery/processors/impress_js/add_impress_js.rb
slippery-0.2.0 lib/slippery/processors/impress_js/add_impress_js.rb