class ContentfulConverter::Converter

Public Class Methods

convert(html) click to toggle source
# File lib/contentful_converter/converter.rb, line 10
def convert(html)
  raise_error_unless_string(html)

  convert_to_rich_text(nokogiri_fragment(html))
end

Private Class Methods

convert_to_rich_text(nokogiri_fragment) click to toggle source
# File lib/contentful_converter/converter.rb, line 24
def convert_to_rich_text(nokogiri_fragment)
  TreeCloner.nokogiri_to_rich_text(nokogiri_fragment)
end
nokogiri_fragment(html) click to toggle source
# File lib/contentful_converter/converter.rb, line 28
def nokogiri_fragment(html)
  NokogiriBuilder.build(html)
end
raise_error_unless_string(param) click to toggle source
# File lib/contentful_converter/converter.rb, line 18
def raise_error_unless_string(param)
  return if param.is_a?(String)

  raise ArgumentError, 'Converter param needs to be a string'
end