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
- #data_attributes(attrs) ⇒ Object
- #include_local_css(element, path) ⇒ Object
- #include_local_javascript(element, path) ⇒ Object
- #javascript_include_tag(path) ⇒ Object
- #stylesheet_link_tag(path) ⇒ Object
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
#data_attributes(attrs) ⇒ Object
23 24 25 |
# File 'lib/slippery/processor_helpers.rb', line 23 def data_attributes(attrs) Hash[*attrs.flat_map { |k, v| ["data-#{k}", v] }] end |
#include_local_css(element, path) ⇒ Object
11 12 13 |
# File 'lib/slippery/processor_helpers.rb', line 11 def include_local_css(element, path) element.add stylesheet_link_tag(path) end |
#include_local_javascript(element, path) ⇒ Object
7 8 9 |
# File 'lib/slippery/processor_helpers.rb', line 7 def include_local_javascript(element, path) element.add javascript_include_tag(path) end |
#javascript_include_tag(path) ⇒ Object
15 16 17 |
# File 'lib/slippery/processor_helpers.rb', line 15 def javascript_include_tag(path) H[:script, {src: path, type: 'text/javascript'}] end |
#stylesheet_link_tag(path) ⇒ Object
19 20 21 |
# File 'lib/slippery/processor_helpers.rb', line 19 def stylesheet_link_tag(path) H[:link, {href: path, rel: 'stylesheet'}] end |