Class: DebsFromRepos::ListUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/debsfromrepos/list_url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, suite = '', component = '') ⇒ ListUrl



6
7
8
9
10
# File 'lib/debsfromrepos/list_url.rb', line 6

def initialize(url, suite='', component='')
  @url = url
  @suite = suite
  @component = component
end

Instance Attribute Details

#componentObject

Returns the value of attribute component.



4
5
6
# File 'lib/debsfromrepos/list_url.rb', line 4

def component
  @component
end

#suiteObject

Returns the value of attribute suite.



4
5
6
# File 'lib/debsfromrepos/list_url.rb', line 4

def suite
  @suite
end

Instance Method Details

#get_urlObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/debsfromrepos/list_url.rb', line 12

def get_url
  if @suite.empty?
    $stderr.puts "ERROR: the suite was missing"
    return nil
  elsif @component.empty?
    $stderr.puts "ERROR: the component was missing"
    return nil
  end
  unless @url.match(/(http|ftp)s*:\/\/([\S]*)\/.*/)
    $stderr.puts "ERROR: the url format is wrong"
    return nil
  end
  "#{@url}/dists/#{@suite}/#{@component}/binary-i386/Packages.gz"
end