Class: Suppository::DpkgDebLine

Inherits:
Object
  • Object
show all
Defined in:
lib/suppository/dpkg_deb_line.rb

Constant Summary collapse

DESCRIPTION_FIELD =
'Description'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ DpkgDebLine

Returns a new instance of DpkgDebLine.



9
10
11
12
13
14
15
16
17
18
# File 'lib/suppository/dpkg_deb_line.rb', line 9

def initialize(line)
  field = split_line(line)
  if description?(line)
    @attributes = { DESCRIPTION_FIELD => line }
  elsif field
    @attributes = { field['fieldname'] => field['fieldvalue'] }
  else
    raise "can't parse line - '#{line}'"
  end
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/suppository/dpkg_deb_line.rb', line 7

def attributes
  @attributes
end