Sha256: 85c389c6c8a67ac713bda425d02b2e288dcb46144cc575c6a12ea6a39c3c595b

Contents?: true

Size: 654 Bytes

Versions: 4

Compression:

Stored size: 654 Bytes

Contents

class Ecu
  class Festwert < Label
    def self.dcm_header
      %r{FESTWERT\s+(?<name>[A-Za-z0-9\._]+)}
    end

    def to_dcm(indented=false)
      fmtstr = indented ? "%-25s%s\n" : "%s %s\n"

      sprintf(fmtstr, type.upcase, name).tap do |str|
        str << "  LANGNAME #{description.enquote}\n" if description
        str << "  FUNKTION #{function}\n"            if function
        str << "  EINHEIT_W #{unit.enquote}\n"       if unit
        str << case value
               when Numeric then "  WERT #{value}\n"
               when String  then "  TEXT #{value.enquote}\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.9 lib/ecu/interfaces/dcm/festwert.rb
automotive-ecu-0.1.8 lib/ecu/interfaces/dcm/festwert.rb
automotive-ecu-0.1.7 lib/ecu/interfaces/dcm/festwert.rb
automotive-ecu-0.1.6 lib/ecu/interfaces/dcm/festwert.rb