class RubyTDMS::AggregateChannel

Public Class Methods

new(channels = []) click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 5
def initialize(channels = [])
        @channels = channels
end

Public Instance Methods

as_json() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 40
def as_json
        result = @channels[0].as_json
        # Iterate over all channel objects and update properties
        result[:properties] = @channels.reduce({}) do |properties, channel|
                channel.properties.each do |property|
                        properties[property.name.to_sym] = property.value
                end
                properties
        end
        result[:values] = values.to_a
        result
end
data_type() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 25
def data_type
        @channels[0].data_type
end
data_type_id() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 30
def data_type_id
        @channels[0].data_type_id
end
inspect() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 10
def inspect
        "#<#{self.class.name}:#{self.object_id} path=#{path.inspect}, #{@channels.length} channel(s)>"
end
name() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 20
def name
        @channels[0].name
end
path() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 15
def path
        @channels[0].path
end
values() click to toggle source
# File lib/ruby_tdms/aggregate_channel.rb, line 35
def values
        @values ||= AggregateChannelEnumerator.new @channels
end