Sha256: 74640bcd7bf864100a0b58a9203fe513e85eea4a2a12ed153fcd521010c29e39

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module LensProtocol
  module OMA
    Line = Struct.new(:label, :data, :raw, keyword_init: true) do
      def self.parse raw_line
        raise ParsingError.new('The label separator is missing', raw_line) unless raw_line.include?('=')

        label, data = raw_line.split('=', -1)
        Line.new label: label, data: data, raw: raw_line
      end

      def to_s
        "#{label}=#{data}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lens_protocol-0.2.1 lib/lens_protocol/oma/line.rb
lens_protocol-0.2.0 lib/lens_protocol/oma/line.rb