Class: Alchemy::ElementsBlockHelper::ElementViewHelper
- Inherits:
-
BlockHelper
- Object
- BlockHelper
- Alchemy::ElementsBlockHelper::ElementViewHelper
- Defined in:
- app/helpers/alchemy/elements_block_helper.rb
Overview
Block-level helper class for element views.
Instance Method Summary collapse
-
#content(name) ⇒ Object
Returns one of the element’s contents (ie. essence instances).
-
#essence(name) ⇒ Object
Return’s the given content’s essence.
-
#has?(name) ⇒ Boolean
Returns true if the given content has been filled by the user.
-
#ingredient(name) ⇒ Object
Returns the ingredient of one of the element’s contents.
-
#render(name, *args) ⇒ Object
Renders one of the element’s contents.
Methods inherited from BlockHelper
#element, #helpers, #initialize, #opts
Constructor Details
This class inherits a constructor from Alchemy::ElementsBlockHelper::BlockHelper
Instance Method Details
#content(name) ⇒ Object
Returns one of the element’s contents (ie. essence instances).
38 39 40 |
# File 'app/helpers/alchemy/elements_block_helper.rb', line 38 def content(name) element.content_by_name(name) end |
#essence(name) ⇒ Object
Return’s the given content’s essence.
56 57 58 |
# File 'app/helpers/alchemy/elements_block_helper.rb', line 56 def essence(name) content(name).try(:essence) end |
#has?(name) ⇒ Boolean
Returns true if the given content has been filled by the user.
50 51 52 |
# File 'app/helpers/alchemy/elements_block_helper.rb', line 50 def has?(name) element.has_ingredient?(name) end |
#ingredient(name) ⇒ Object
Returns the ingredient of one of the element’s contents.
44 45 46 |
# File 'app/helpers/alchemy/elements_block_helper.rb', line 44 def ingredient(name) element.ingredient(name) end |
#render(name, *args) ⇒ Object
Renders one of the element’s contents.
32 33 34 |
# File 'app/helpers/alchemy/elements_block_helper.rb', line 32 def render(name, *args) helpers.render_essence_view_by_name(element, name.to_s, *args) end |