Class: Wiki2Go::UrlFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/Wiki2Go/UrlFinder.rb

Instance Method Summary collapse

Instance Method Details

#number_of_urls_in(content) ⇒ Object


13
14
15
# File 'lib/Wiki2Go/UrlFinder.rb', line 13

def number_of_urls_in(content)
  urls_in(content).size
end

#old_number_of_urls_in(content) ⇒ Object


4
5
6
7
8
9
10
11
# File 'lib/Wiki2Go/UrlFinder.rb', line 4

def old_number_of_urls_in( content )
  counter = 0
  content.scan( /((http|ftp|gopher|news|https)\:\/\/((\w|\/|\.|_|-|\?|\=|&|;|\~)+))/ ) { 
    puts $1 + " => " + $3
    counter+=1 
  }  
  return counter
end

#urls_in(content) ⇒ Object


17
18
19
20
21
22
23
# File 'lib/Wiki2Go/UrlFinder.rb', line 17

def urls_in( content )
  urls = []
  content.scan( /((http|ftp|gopher|news|https)\:\/\/((\w|\/|\.|_|-|\?|\=|&|;|\~)+))/ ) { 
    urls << $1
  }  
  urls
end