Sha256: e03f5cc3b8e3b8efb2f8d41ddaf1b0ab138b67160bdd466a0d8095a63ddf8364

Contents?: true

Size: 651 Bytes

Versions: 4

Compression:

Stored size: 651 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
automotive-ecu-0.1.3 lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb
automotive-ecu-0.1.2 lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb
automotive-ecu-0.1.1 lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb
automotive-ecu-0.1.0 lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb