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.



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

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/suppository/dpkg_deb_line.rb', line 5

def attributes
  @attributes
end