1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/action_text/html_conversion.rb
Alberto Almagro 34f2e9492b Add frozen_string_literal: true
Adds frozen_string_literal: true comment on top of all currently existing files
2018-10-08 23:44:25 +02:00

24 lines
506 B
Ruby

# frozen_string_literal: true
module ActionText
module HtmlConversion
extend self
def node_to_html(node)
node.to_html(save_with: Nokogiri::XML::Node::SaveOptions::AS_HTML)
end
def fragment_for_html(html)
document.fragment(html)
end
def create_element(tag_name, attributes = {})
document.create_element(tag_name, attributes)
end
private
def document
Nokogiri::HTML::Document.new.tap { |doc| doc.encoding = "UTF-8" }
end
end
end