Class: ImageDownloader::Arguments

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, path) ⇒ Arguments

Returns a new instance of Arguments.



5
6
7
8
# File 'lib/image_downloader/arguments.rb', line 5

def initialize(url, path)
  @url = url
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/image_downloader/arguments.rb', line 3

def path
  @path
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/image_downloader/arguments.rb', line 3

def url
  @url
end

Instance Method Details

#checkObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/image_downloader/arguments.rb', line 10

def check
  if !self.url
    p "Not specified url"
    exit
  end
  if !self.path
    p "Not specified path"
    exit
  end
end

#normalizeObject



21
22
23
24
# File 'lib/image_downloader/arguments.rb', line 21

def normalize
  self.url = URL.normalize(self.url)
  self.path = self.path.gsub(/\/+$/,'')
end