Class: ImageDownloader::URL

Inherits:
Object
  • Object
show all
Defined in:
lib/image_downloader/url.rb

Class Method Summary collapse

Class Method Details

.contain_http?(url) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/image_downloader/url.rb', line 4

def self.contain_http?(url)
  url =~ /^(http|https)/i ? true : false
end

.normalize(url) ⇒ Object



8
9
10
# File 'lib/image_downloader/url.rb', line 8

def self.normalize(url)
  contain_http?(url) ? url : 'http://' + url
end

.remove_new_line_symbols!(str) ⇒ Object



12
13
14
15
# File 'lib/image_downloader/url.rb', line 12

def self.remove_new_line_symbols!(str)
  str.gsub!(/\r/,'') if str
  str.gsub!(/\n/,'') if str
end