Class: Alchemy::Ingredients::BaseView
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Alchemy::Ingredients::BaseView
- Defined in:
- app/components/alchemy/ingredients/base_view.rb
Direct Known Subclasses
AudioView, BooleanView, DatetimeView, FileView, HeadlineView, HtmlView, LinkView, NodeView, PageView, PictureView, RichtextView, SelectView, TextView, VideoView
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#ingredient ⇒ Object
readonly
Returns the value of attribute ingredient.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ingredient, html_options: {}) ⇒ BaseView
constructor
A new instance of BaseView.
- #render? ⇒ Boolean
Constructor Details
#initialize(ingredient, html_options: {}) ⇒ BaseView
Returns a new instance of BaseView.
11 12 13 14 15 16 |
# File 'app/components/alchemy/ingredients/base_view.rb', line 11 def initialize(ingredient, html_options: {}) raise ArgumentError, "Ingredient missing!" if ingredient.nil? @ingredient = ingredient @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
4 5 6 |
# File 'app/components/alchemy/ingredients/base_view.rb', line 4 def @html_options end |
#ingredient ⇒ Object (readonly)
Returns the value of attribute ingredient.
4 5 6 |
# File 'app/components/alchemy/ingredients/base_view.rb', line 4 def ingredient @ingredient end |
Instance Method Details
#call ⇒ Object
18 19 20 |
# File 'app/components/alchemy/ingredients/base_view.rb', line 18 def call value.html_safe end |
#render? ⇒ Boolean
22 23 24 |
# File 'app/components/alchemy/ingredients/base_view.rb', line 22 def render? value.present? end |