Sha256: dad95128415dd85ec8412f3e6812ae22dec6258402665be21ab9ead957d480e1

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Debsacker
  module Package
    class Control

      def initialize(file)
        @control_content = {}

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

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

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

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

    protected

      def file_content(file)
        File.readlines(file).collect(&:strip).reject(&:empty?)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
debsacker-0.1.5 lib/debsacker/package/control.rb
debsacker-0.1.3 lib/debsacker/package/control.rb