Sha256: 4a17ec4f4c787f8daabd220af9712f60c20668262444da7ef5e2a196b5a51abf

Contents?: true

Size: 647 Bytes

Versions: 11

Compression:

Stored size: 647 Bytes

Contents

require_relative "../../../core_ext"
require_relative "lab_parser"

class Ecu
  class LabelList
    def self.from_lab(str)
      _, labels, headers, subheaders = LabParser.call(str)
      new(labels, headers, subheaders)
    end

    def to_lab
      out = []

      out.append(*headers.map { |l| "; #{l}" }, "") unless headers.empty?

      out.append("[SETTINGS]")
      out.append("Version;V1.1")
      out.append("MultiRasterSeparator;&")
      out.append("")

      out.append(*subheaders.map { |l| "; #{l}" }, "") unless subheaders.empty?

      out.append("[Label]")
      out.append(*map(&:to_lab))

      out.join("\n")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
automotive-ecu-0.1.10 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.9 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.8 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.7 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.6 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.5 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.4 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.3 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.2 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.1 lib/ecu/interfaces/lab/label_list.rb
automotive-ecu-0.1.0 lib/ecu/interfaces/lab/label_list.rb