require_relative "../../../core_ext" class Ecu class Festwerteblock < Label def self.dcm_header %r{^FESTWERTEBLOCK\s+(?[A-Za-z0-9\._]+)\s+(?\d+)(?:\s+@\s+(?\d+))?} end def to_dcm(indented=false) fmtstr = indented ? "%-25s%s %s" : "%s %s %d" sprintf(fmtstr, type.upcase, name, xdim).tap do |str| str << " @ #{ydim}" if ydim != 1 str << "\n" str << " LANGNAME #{description.enquote}\n" if description str << " FUNKTION #{function}\n" if function str << " EINHEIT_W #{unit.enquote}\n" if unit value.each do |row| str << case row.first when Numeric then " WERT #{row.join(" ")}\n" when String then " TEXT #{row.map(&:enquote).join(" ")}\n" end end str << "END\n" end end end end