Class: Perron::HtmlProcessor::TargetBlank
- Inherits:
-
HtmlProcessor::Base
- Object
- HtmlProcessor::Base
- Perron::HtmlProcessor::TargetBlank
- Defined in:
- lib/perron/html_processor/target_blank.rb
Instance Method Summary collapse
Instance Method Details
#process ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/perron/html_processor/target_blank.rb', line 8 def process @html.css("a").each do |link| href = link["href"] next if href.blank? || href.start_with?("/", "#", "mailto:") link["target"] = "_blank" end end |