Class: UrlExtractor::PlainText
- Inherits:
-
Object
- Object
- UrlExtractor::PlainText
- Defined in:
- lib/url_extractor/plain_text.rb
Instance Method Summary collapse
-
#initialize(ignore_patterns = []) ⇒ PlainText
constructor
A new instance of PlainText.
- #replace_urls(text) ⇒ Object
Constructor Details
#initialize(ignore_patterns = []) ⇒ PlainText
Returns a new instance of PlainText.
6 7 8 |
# File 'lib/url_extractor/plain_text.rb', line 6 def initialize(ignore_patterns = []) @ignore_patterns = ignore_patterns end |
Instance Method Details
#replace_urls(text) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/url_extractor/plain_text.rb', line 10 def replace_urls(text) urls = URI.extract text urls.each do |url| next if ignogred_url?(url) text = text.gsub url, yield(url) end text end |