Method: ActionText::Fragment#replace
- Defined in:
- actiontext/lib/action_text/fragment.rb
#replace(selector) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'actiontext/lib/action_text/fragment.rb', line 41 def replace(selector) update do |source| source.css(selector).each do |node| replacement_node = yield(node) node.replace(replacement_node.to_s) if node != replacement_node end end end |