Sha256: 83f6d2b35c9f8218b5ca83a4cf351b379fa5bfe727e977b65796cf34d686b8fe

Contents?: true

Size: 1.76 KB

Versions: 6

Compression:

Stored size: 1.76 KB

Contents

o:$YARD::CodeObjects::MethodObject:@visibility:public:@source_type:	ruby:@scope:
class:@source"‡def replace_resource_in_html html, original_filename, new_filename, resource_type
  # FIXME better to raise an error, return an unprocessed file maybe not good.
  return html if original_filename.blank? or new_filename.blank?
  doc = Nokogiri::HTML(html)
  doc.css('img, link').each do |element|
    # FIXME seems will have the problem if have duplicated filename in different dir
    next if element.name == "link" && element['href'].blank?
    next if element.name == "img" && element['src'].blank?

    case
    when element.name == "link" && get_resource_url(element['href'], resource_type) == original_filename
      element['href'] = element['href'].sub(original_filename, new_filename)
    when element.name == "img" && get_resource_url(element['src'], resource_type) == original_filename
      element['src'] = element['src'].sub(original_filename, new_filename)
    end
  end

  doc.to_html
end:@explicitT:
@tags[:@current_file_has_commentsT:
@linei4:@signature"Vdef replace_resource_in_html html, original_filename, new_filename, resource_type:@files[["5lib/mail_engine/html_document_assets_replacer.rbi4:
@name:replace_resource_in_html:
@path"DMailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html:@docstringIC:YARD::Docstring"5replace the old filename in html by new filename:	@all["5replace the old filename in html by new filename:@line_rangeo:
Range:endi3:
begini3:	exclF;[:@ref_tags[:
@summary0:@objectu:YARD::StubProxyDMailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html:@namespaceu;!+MailEngine::HtmlDocumentAssetsReplacer:
@dynamicT:@parameters[	["	html0["original_filename0["new_filename0["resource_type0:@docstring_extra0

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mail_engine-0.1.6 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat
mail_engine-0.1.5 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat
mail_engine-0.1.4 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat
mail_engine-0.1.3 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat
mail_engine-0.1.2 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat
mail_engine-0.1.1 .yardoc/objects/MailEngine/HtmlDocumentAssetsReplacer/replace_resource_in_html_c.dat