Class: Shrinker::Parser::Text

Inherits:
Abstract
  • Object
show all
Defined in:
lib/shrinker/parser/text.rb

Instance Attribute Summary

Attributes inherited from Abstract

#attributes, #config, #content

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, replace

Constructor Details

This class inherits a constructor from Shrinker::Parser::Abstract

Instance Method Details

#replaceObject



4
5
6
7
8
9
10
11
12
# File 'lib/shrinker/parser/text.rb', line 4

def replace
  content.gsub(url_regex) do |url|
    matched_url = $1

    next if matched_url =~ excluded_path_regex

    url.gsub!(matched_url, shrink_url(matched_url))
  end
end