lib/ecu/interfaces/dcm/kennlinie.rb in automotive-ecu-0.1.3 vs lib/ecu/interfaces/dcm/kennlinie.rb in automotive-ecu-0.1.4

- old
+ new

@@ -2,11 +2,13 @@ class Kennlinie < Label def self.dcm_header %r{^KENNLINIE\s+(?<name>[A-Za-z0-9\._]+)\s+(?<xdim>\d+)} end - def to_dcm - "#{type.upcase} #{name} #{xdim}\n".tap do |str| + def to_dcm(indented=false) + fmtstr = indented ? "%-26s%s %s\n" : "%s %s %d\n" + + sprintf(fmtstr, type.upcase, name, xdim).tap do |str| str << " LANGNAME #{description.enquote}\n" if description str << " FUNKTION #{function}\n" if function str << " EINHEIT_X #{xunit.enquote}\n" if xunit str << " EINHEIT_W #{unit.enquote}\n" if unit str << case xvalue.first