Class: Pulitzer::UpdateContentElement
- Inherits:
-
Object
- Object
- Pulitzer::UpdateContentElement
- Defined in:
- app/interactions/pulitzer/update_content_element.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content_element, params) ⇒ UpdateContentElement
constructor
A new instance of UpdateContentElement.
Constructor Details
#initialize(content_element, params) ⇒ UpdateContentElement
Returns a new instance of UpdateContentElement.
3 4 5 |
# File 'app/interactions/pulitzer/update_content_element.rb', line 3 def initialize(content_element, params) @content_element, @params = content_element, params.dup end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/interactions/pulitzer/update_content_element.rb', line 7 def call text_editor = Pulitzer..detect { || [:name] == content_element.text_editor } if 'Kramdown' == text_editor[:kind] params[:markdown] = params[:body] params[:body] = Kramdown::Document.new(params[:body]).to_html end @content_element.update params end |