Class: OpenC3::FormatStringParser
- Defined in:
- lib/openc3/packets/parsers/format_string_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_format_string(item) ⇒ Object
-
#initialize(parser) ⇒ FormatStringParser
constructor
A new instance of FormatStringParser.
- #verify_parameters ⇒ Object
Constructor Details
#initialize(parser) ⇒ FormatStringParser
Returns a new instance of FormatStringParser.
34 35 36 |
# File 'lib/openc3/packets/parsers/format_string_parser.rb', line 34 def initialize(parser) @parser = parser end |
Class Method Details
.parse(parser, item) ⇒ Object
27 28 29 30 31 |
# File 'lib/openc3/packets/parsers/format_string_parser.rb', line 27 def self.parse(parser, item) parser = FormatStringParser.new(parser) parser.verify_parameters() parser.create_format_string(item) end |
Instance Method Details
#create_format_string(item) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/openc3/packets/parsers/format_string_parser.rb', line 44 def create_format_string(item) item.format_string = @parser.parameters[0] # Only test the format string if there is not a read conversion because # read conversion can return any type test_format_string(item) unless item.read_conversion end |
#verify_parameters ⇒ Object
38 39 40 41 |
# File 'lib/openc3/packets/parsers/format_string_parser.rb', line 38 def verify_parameters @usage = "FORMAT_STRING <PRINTF STYLE STRING>" @parser.verify_num_parameters(1, 1, @usage) end |