class Ecu class Kennlinie < Label def self.dcm_header %r{^KENNLINIE\s+(?[A-Za-z0-9\._]+)\s+(?\d+)} end def to_dcm "#{type.upcase} #{name} #{xdim}\n".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 when Numeric then " ST/X #{xvalue.join(" ")}\n" when String then " ST_TX/X #{xvalue.map(&:enquote).join(" ")}\n" end str << case value.first when Numeric then " WERT #{value.join(" ")}\n" when String then " TEXT #{value.map(&:enquote).join(" ")}\n" end str << "END\n" end end end end