Class: LensProtocol::OMA::Formatter
- Inherits:
-
Object
- Object
- LensProtocol::OMA::Formatter
- Defined in:
- lib/lens_protocol/oma/formatter.rb
Instance Method Summary collapse
-
#format(message, line_separator: "\r\n", start_of_message: '', end_of_message: '', **opts) ⇒ Object
Generates the OMA string from a Message.
- #format_lines(message, types: {}) ⇒ Object
Instance Method Details
#format(message, line_separator: "\r\n", start_of_message: '', end_of_message: '', **opts) ⇒ Object
Generates the OMA string from a Message
5 6 7 8 9 10 11 12 |
# File 'lib/lens_protocol/oma/formatter.rb', line 5 def format , line_separator: "\r\n", start_of_message: '', end_of_message: '', **opts [ , format_lines(, **opts).join(line_separator), line_separator, ].join end |
#format_lines(message, types: {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/lens_protocol/oma/formatter.rb', line 14 def format_lines , types: {} types = TYPES.merge(types) .records.flat_map do |label, record| format_record label, record.value, types end end |