Sha256: 2b76cf5deaf9749251cffecd4c98d334aeb9c0e5547d55fe1e2f275fad08b9d5

Contents?: true

Size: 499 Bytes

Versions: 2

Compression:

Stored size: 499 Bytes

Contents

module LensProtocol
  module OMA
    module Types
      class Single < Type
        def parse line, next_lines
          value = parse_value line.data
          [value, next_lines]
        end

        def wrap value, _message_hash, label
          raise ValidationError, "#{label}: Expected a single value. Got #{value}" if value.respond_to?(:each)
          value
        end

        def format label, value
          build_line label, format_value(value)
        end
      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/types/single.rb
lens_protocol-0.2.0 lib/lens_protocol/oma/types/single.rb