class Reactor::Attributes::HTMLSerializer
Public Class Methods
new(attr, value)
click to toggle source
# File lib/reactor/attributes/html_serializer.rb, line 6 def initialize(attr, value) @attr, @value = attr, value.to_str end
Public Instance Methods
serialize()
click to toggle source
# File lib/reactor/attributes/html_serializer.rb, line 10 def serialize serialize_html end
Private Instance Methods
serialize_html()
click to toggle source
# File lib/reactor/attributes/html_serializer.rb, line 15 def serialize_html link_expressions = [/(href|src|usemap)\s*=\s*"([^"]*)"/, /(href|src|usemap)\s*=\s*'([^']*)'/] link_expressions.each do |expr| @value.gsub!(expr) do |string| link = Reactor::Support::LinkMatcher.new($2) if link.recognized? "#{$1}=\"#{link.rewrite_url}\"" else string end end end @value end