Class: ODDB::OdbaExporter::Line

Inherits:
Object
  • Object
show all
Defined in:
ext/export/src/oddbdat.rb

Direct Known Subclasses

AtcLine, CompLine, GalenicFormLine, LimTxtLine, MCMLine, PackageLine

Instance Method Summary (collapse)

Constructor Details

- (Line) initialize(*args)

A new instance of Line



268
269
270
271
# File 'ext/export/src/oddbdat.rb', line 268

def initialize(*args)
  @date = Date.today.strftime("%Y%m%d%H%M%S")
  @structure = structure
end

Instance Method Details

- (Object) content(structure)



272
273
274
275
276
277
278
279
280
# File 'ext/export/src/oddbdat.rb', line 272

def content(structure)
  return [] if structure.nil?
  fields = Array.new(self::class::LENGTH)
  structure.each_pair { |place, field|
    # schl├╝ssel in structure entsprechen der OddbDat-Doku
    fields[place-1] = field 
  }
  fields
end

- (Boolean) empty?

Returns:

  • (Boolean)


281
282
283
# File 'ext/export/src/oddbdat.rb', line 281

def empty?
  @structure.nil?
end

- (Object) structure



284
285
# File 'ext/export/src/oddbdat.rb', line 284

def structure
end

- (Object) to_s



286
287
288
# File 'ext/export/src/oddbdat.rb', line 286

def to_s
  content(@structure).join('|').gsub("\000", "")
end