Class: Slippery::Processors::Shower

Inherits:
Object
  • Object
show all
Includes:
Slippery::ProcessorHelpers
Defined in:
lib/slippery/processors/shower.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{theme: :material,
 ratio: '4x3',
 color_key: '#4caf50'
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Slippery::ProcessorHelpers

asset_uri, #data_attributes, #hash_to_js, #include_local_css, #include_local_javascript, included, #javascript_include_tag, #stylesheet_link_tag

Constructor Details

#initialize(options = {}) ⇒ Shower

Returns a new instance of Shower.



17
18
19
# File 'lib/slippery/processors/shower.rb', line 17

def initialize(options = {})
  @options = DEFAULT_OPTIONS.merge(options).freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



10
11
12
# File 'lib/slippery/processors/shower.rb', line 10

def attributes
  @attributes
end

Class Method Details

.call(doc) ⇒ Object



6
7
8
# File 'lib/slippery/processors/shower.rb', line 6

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

Instance Method Details

#call(doc) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/slippery/processors/shower.rb', line 33

def call(doc)
  doc.process(
    add_shower_js,
    add_shower_css,
    set_body_classes,
    meta_tags,
    progress_bar,
    header
  )
end

#color_keyObject



29
30
31
# File 'lib/slippery/processors/shower.rb', line 29

def color_key
  @options[:color_key]
end

#ratioObject



25
26
27
# File 'lib/slippery/processors/shower.rb', line 25

def ratio
  @options[:ratio].sub('x', ' / ')
end

#themeObject



21
22
23
# File 'lib/slippery/processors/shower.rb', line 21

def theme
  @options[:theme]
end