Class: UrlParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ramparts/parsers/url_parser.rb

Overview

Parses text and attempts to find urls

Instance Method Summary collapse

Instance Method Details

#count_url_instances(text, options) ⇒ Object

Counts the number of occurrences of that url within the block of text

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/ramparts/parsers/url_parser.rb', line 8

def count_url_instances(text, options)
  raise ArgumentError, ARGUMENT_ERROR_TEXT unless text.is_a? String

  text = parse_url(text)
  url_instances(text, options).length
end