class RubyTDMS::Objects::Base

TDMS object base. All objects hold a collection of Segment references since objects can be striped across segments.

Attributes

path[R]
properties[R]
segment[R]
stream[R]

Public Class Methods

new(path, document, segment) click to toggle source
# File lib/ruby_tdms/objects/base.rb, line 9
def initialize(path, document, segment)
        @path = path
        @document = document
        @segment = segment
        @stream = document.stream

        @properties = []
end

Public Instance Methods

as_json() click to toggle source
# File lib/ruby_tdms/objects/base.rb, line 29
def as_json
        {
                path: path.to_s,
                properties: properties.reduce({}) { |properties, property| properties[property.name.to_s.to_sym] = property.value; properties }
        }
end
continue_stream(stream, previous_channel) click to toggle source
# File lib/ruby_tdms/objects/base.rb, line 19
def continue_stream(stream, previous_channel)
        parse_properties stream
end
parse_stream(stream) click to toggle source
# File lib/ruby_tdms/objects/base.rb, line 24
def parse_stream(stream)
        parse_properties stream
end

Protected Instance Methods

parse_properties(stream) click to toggle source
# File lib/ruby_tdms/objects/base.rb, line 39
def parse_properties(stream)
        @properties_length = stream.read_u32
        @properties_length.times do
                @properties << stream.read_property(@segment.big_endian?)
        end
end