Module: Slippery::ProcessorHelpers

Included in:
Slippery::Processors::ImpressJs::AddImpressJs, Slippery::Processors::RevealJs::AddRevealJs
Defined in:
lib/slippery/processor_helpers.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klz) ⇒ Object



3
4
5
# File 'lib/slippery/processor_helpers.rb', line 3

def self.included(klz)
  klz.extend ClassMethods
end

Instance Method Details

#asset_uri(path) ⇒ Object



7
8
9
# File 'lib/slippery/processor_helpers.rb', line 7

def asset_uri(path)
  "file://" + Slippery::ROOT.join('assets', path).to_s
end

#data_attributes(attrs) ⇒ Object



27
28
29
# File 'lib/slippery/processor_helpers.rb', line 27

def data_attributes(attrs)
  Hash[*attrs.flat_map { |k, v| ["data-#{k}", v] }]
end

#include_local_css(element, path) ⇒ Object



15
16
17
# File 'lib/slippery/processor_helpers.rb', line 15

def include_local_css(element, path)
  element.add stylesheet_link_tag(path)
end

#include_local_javascript(element, path) ⇒ Object



11
12
13
# File 'lib/slippery/processor_helpers.rb', line 11

def include_local_javascript(element, path)
  element.add javascript_include_tag(path)
end

#javascript_include_tag(path) ⇒ Object



19
20
21
# File 'lib/slippery/processor_helpers.rb', line 19

def javascript_include_tag(path)
  H[:script, {src: path, type: 'text/javascript'}]
end


23
24
25
# File 'lib/slippery/processor_helpers.rb', line 23

def stylesheet_link_tag(path)
  H[:link, {href: path, rel: 'stylesheet'}]
end