Sha256: 3bf342ad7928d216799da74fe886e4c06bd3443c908234001b4b53d3da490935
Contents?: true
Size: 1.76 KB
Versions: 9
Compression:
Stored size: 1.76 KB
Contents
o:$YARD::CodeObjects::MethodObject:@current_file_has_commentsT: @linei4:@scope: class:@docstringIC:YARD::Docstring"5replace the old filename in html by new filename:@ref_tags[ :@objectu:YARD::StubProxyDMailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html: @summary0: @all["5replace the old filename in html by new filename:@line_rangeo: Range:endi3: begini3: exclF: @tags[ :@parameters[ [" html0["original_filename0["new_filename0["resource_type0:@namespaceu;+MailEngine::HtmlDocumentAssetsReplacer:@files[["5lib/mail_engine/html_document_assets_replacer.rbi4: @name:replace_resource_in_html: @dynamicT: @path"DMailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html:@docstring_extra0:@visibility:public:@source_type: ruby:@signature"Vdef replace_resource_in_html html, original_filename, new_filename, resource_type:@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;[
Version data entries
9 entries across 9 versions & 1 rubygems