instance method
replace
Ruby on Rails 8.0.4
Since v6.0.6Signature
replace(selector)
No documentation comment.
Parameters
-
selectorreq
Source
# 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
Defined in actiontext/lib/action_text/fragment.rb line 41
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionText::Fragment