Class: Alchemy::Ingredients::HeadlineView

Inherits:
BaseView
  • Object
show all
Defined in:
app/components/alchemy/ingredients/headline_view.rb

Instance Attribute Summary

Attributes inherited from BaseView

#html_options, #ingredient

Instance Method Summary collapse

Methods inherited from BaseView

#render?

Constructor Details

#initialize(ingredient, level: nil, html_options: {}) ⇒ HeadlineView

Returns a new instance of HeadlineView.



4
5
6
7
# File 'app/components/alchemy/ingredients/headline_view.rb', line 4

def initialize(ingredient, level: nil, html_options: {})
  super(ingredient, html_options: html_options)
  @level = level
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
# File 'app/components/alchemy/ingredients/headline_view.rb', line 9

def call
   "h#{@level || ingredient.level}",
    ingredient.value,
    id: ingredient.dom_id.presence,
    class: [
      ingredient.size ? "h#{ingredient.size}" : nil,
      html_options[:class]
    ]
end