Class: LensProtocol::OMA::Types::Single
- Inherits:
-
Type
- Object
- Type
- LensProtocol::OMA::Types::Single
show all
- Defined in:
- lib/lens_protocol/oma/types/single.rb
Instance Method Summary
collapse
Methods inherited from Type
#initialize
Instance Method Details
15
16
17
|
# File 'lib/lens_protocol/oma/types/single.rb', line 15
def format label, value
build_line label, format_value(value)
end
|
#parse(line, next_lines) ⇒ Object
5
6
7
8
|
# File 'lib/lens_protocol/oma/types/single.rb', line 5
def parse line, next_lines
value = parse_value line.data
[value, next_lines]
end
|
#wrap(value, _message_hash, label) ⇒ Object
10
11
12
13
|
# File 'lib/lens_protocol/oma/types/single.rb', line 10
def wrap value, _message_hash, label
raise ValidationError, "#{label}: Expected a single value. Got #{value}" if value.respond_to?(:each)
value
end
|