Class: Alchemy::Ingredients::RichtextView
- Defined in:
- app/components/alchemy/ingredients/richtext_view.rb
Instance Attribute Summary collapse
-
#plain_text ⇒ Object
readonly
Returns the value of attribute plain_text.
Attributes inherited from BaseView
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ingredient, plain_text: nil, html_options: {}) ⇒ RichtextView
constructor
A new instance of RichtextView.
Methods inherited from BaseView
Constructor Details
#initialize(ingredient, plain_text: nil, html_options: {}) ⇒ RichtextView
Returns a new instance of RichtextView.
8 9 10 11 |
# File 'app/components/alchemy/ingredients/richtext_view.rb', line 8 def initialize(ingredient, plain_text: nil, html_options: {}) super(ingredient) @plain_text = settings_value(:plain_text, value: plain_text, default: false) end |
Instance Attribute Details
#plain_text ⇒ Object (readonly)
Returns the value of attribute plain_text.
4 5 6 |
# File 'app/components/alchemy/ingredients/richtext_view.rb', line 4 def plain_text @plain_text end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/components/alchemy/ingredients/richtext_view.rb', line 13 def call if plain_text ingredient.stripped_body else value.to_s.html_safe end.html_safe end |