Class: Debsacker::Package::Control
- Inherits:
-
Object
- Object
- Debsacker::Package::Control
- Defined in:
- lib/debsacker/package/control.rb
Instance Method Summary collapse
- #[](attribute) ⇒ Object
-
#initialize(file) ⇒ Control
constructor
A new instance of Control.
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 |