Class: DebsFromRepos::ListUrl
- Inherits:
-
Object
- Object
- DebsFromRepos::ListUrl
- Defined in:
- lib/debsfromrepos/list_url.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
Returns the value of attribute component.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#suite ⇒ Object
Returns the value of attribute suite.
Instance Method Summary collapse
- #get_packages_url ⇒ Object
- #get_translations_url(lang = nil) ⇒ Object
-
#initialize(url, suite = '', component = '', lang = nil) ⇒ ListUrl
constructor
A new instance of ListUrl.
Constructor Details
#initialize(url, suite = '', component = '', lang = nil) ⇒ ListUrl
Returns a new instance of ListUrl.
6 7 8 9 10 11 |
# File 'lib/debsfromrepos/list_url.rb', line 6 def initialize(url, suite='', component='', lang=nil) @url = url @suite = suite @component = component @lang = lang end |
Instance Attribute Details
#component ⇒ Object
Returns the value of attribute component.
4 5 6 |
# File 'lib/debsfromrepos/list_url.rb', line 4 def component @component end |
#lang ⇒ Object
Returns the value of attribute lang.
4 5 6 |
# File 'lib/debsfromrepos/list_url.rb', line 4 def lang @lang end |
#suite ⇒ Object
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_packages_url ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/debsfromrepos/list_url.rb', line 13 def get_packages_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 |
#get_translations_url(lang = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/debsfromrepos/list_url.rb', line 28 def get_translations_url(lang=nil) lang = lang ? lang : @lang unless lang $stderr.puts "ERROR: no language has been selected" return nil end unless lang.match(/^[a-z][a-z]$/) $stderr.puts "ERROR: the language is wrong" return nil end "#{@url}/dists/#{@suite}/#{@component}/i18n/Translation-#{lang}.gz" end |