Sha256: d7df0c3cb9ec65ed95c99bdc24d9379cbbee3db4f23248d733decfc91d5d991a

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 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, 'impress.js/js/impress.js')
             .set_attributes({id: 'impress'}.merge(data_attributes(attributes)))
             .add H[:script, "impress().init();"]
         end
       end

     end
   end
 end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slippery-0.0.1 lib/slippery/processors/impress_js/add_impress_js.rb