Class: Debsacker::Package::Control

Inherits:
Object
  • Object
show all
Defined in:
lib/debsacker/package/control.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Control

Returns a new instance of Control.



5
6
7
8
9
10
11
12
13
# File 'lib/debsacker/package/control.rb', line 5

def initialize(file)
  @control_content = {}

  file_content(file).collect do |line|
    content = line.split(': ')

    @control_content[content.first.strip] = content.last.strip
  end
end

Instance Method Details

#[](attribute) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/debsacker/package/control.rb', line 15

def [](attribute)
  value = @control_content[attribute]

  if attribute == 'Build-Depends'
    value.sub('Build-Depends:', '').gsub(/\(.*\)/, '').split(',').collect(&:strip)
  else
    value
  end
end