Class: Alchemy::Ingredients::LinkView
- Defined in:
- app/components/alchemy/ingredients/link_view.rb
Instance Attribute Summary collapse
-
#link_text ⇒ Object
readonly
Returns the value of attribute link_text.
Attributes inherited from BaseView
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ingredient, text: nil, html_options: {}) ⇒ LinkView
constructor
A new instance of LinkView.
Methods inherited from BaseView
Constructor Details
#initialize(ingredient, text: nil, html_options: {}) ⇒ LinkView
Returns a new instance of LinkView.
9 10 11 12 |
# File 'app/components/alchemy/ingredients/link_view.rb', line 9 def initialize(ingredient, text: nil, html_options: {}) super(ingredient, html_options: ) @link_text = settings_value(:text, value: text, default: value) end |
Instance Attribute Details
#link_text ⇒ Object (readonly)
Returns the value of attribute link_text.
4 5 6 |
# File 'app/components/alchemy/ingredients/link_view.rb', line 4 def link_text @link_text end |
Instance Method Details
#call ⇒ Object
14 15 16 |
# File 'app/components/alchemy/ingredients/link_view.rb', line 14 def call link_to(link_text, value, {target: ingredient.link_target.presence}.merge()).html_safe end |