Class: Vizcore::Sync::OscMessage::Parser Private
- Inherits:
-
Object
- Object
- Vizcore::Sync::OscMessage::Parser
- Defined in:
- lib/vizcore/sync/osc_message.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(data) ⇒ Parser
constructor
private
A new instance of Parser.
- #read_arguments(tags) ⇒ Array private
- #read_string ⇒ String? private
Constructor Details
#initialize(data) ⇒ Parser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parser.
33 34 35 36 |
# File 'lib/vizcore/sync/osc_message.rb', line 33 def initialize(data) @data = data.to_s.b @offset = 0 end |
Instance Method Details
#read_arguments(tags) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 55 56 57 58 59 |
# File 'lib/vizcore/sync/osc_message.rb', line 52 def read_arguments() return [] if .to_s.empty? return [] unless .start_with?(",") [1..].to_s.each_char.map do |tag| read_argument(tag) end end |
#read_string ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/vizcore/sync/osc_message.rb', line 39 def read_string start = @offset @offset += 1 while @offset < @data.bytesize && @data.getbyte(@offset) != 0 return nil if @offset >= @data.bytesize value = @data.byteslice(start...@offset).to_s.force_encoding(Encoding::UTF_8) @offset += 1 align_offset value end |