Class: EasyDownloader::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_downloader/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Options

Returns a new instance of Options.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/easy_downloader/options.rb', line 10

def initialize(*options)
  @files = []
  @successful      = false
  @result          = Result.new
  @load_count = 0
  @options = options

  options.extract_options!.each do |key, value|
    send("#{key}=".to_sym, value) if respond_to?("#{key}=".to_sym)
  end
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def files
  @files
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def host
  @host
end

#load_countObject

Returns the value of attribute load_count.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def load_count
  @load_count
end

#local_fileObject

Returns the value of attribute local_file.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def local_file
  @local_file
end

#local_pathObject

Returns the value of attribute local_path.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def local_path
  @local_path
end

#local_patternObject

Returns the value of attribute local_pattern.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def local_pattern
  @local_pattern
end

#passwordObject

Returns the value of attribute password.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def password
  @password
end

#remote_fileObject

Returns the value of attribute remote_file.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def remote_file
  @remote_file
end

#remote_pathObject

Returns the value of attribute remote_path.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def remote_path
  @remote_path
end

#remote_patternObject

Returns the value of attribute remote_pattern.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def remote_pattern
  @remote_pattern
end

#resultObject

Returns the value of attribute result.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def result
  @result
end

#successfulObject

Returns the value of attribute successful.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def successful
  @successful
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def type
  @type
end

#userObject

Returns the value of attribute user.



4
5
6
# File 'lib/easy_downloader/options.rb', line 4

def user
  @user
end

Instance Method Details

#to_dir_path(path) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/easy_downloader/options.rb', line 30

def to_dir_path(path)
  if path
    path =~ /\/$/ ?  path : path + '/'
  else
    ''
  end
end