Class: RubyTDMS::AggregateChannel
- Inherits:
-
Object
- Object
- RubyTDMS::AggregateChannel
- Defined in:
- lib/ruby_tdms/aggregate_channel.rb
Instance Method Summary collapse
- #as_json ⇒ Object
- #data_type ⇒ Object
- #data_type_id ⇒ Object
-
#initialize(channels = []) ⇒ AggregateChannel
constructor
A new instance of AggregateChannel.
- #inspect ⇒ Object
- #name ⇒ Object
- #path ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(channels = []) ⇒ AggregateChannel
Returns a new instance of AggregateChannel.
5 6 7 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 5 def initialize(channels = []) @channels = channels end |
Instance Method Details
#as_json ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 ⇒ Object
25 26 27 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 25 def data_type @channels[0].data_type end |
#data_type_id ⇒ Object
30 31 32 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 30 def data_type_id @channels[0].data_type_id end |
#inspect ⇒ Object
10 11 12 |
# 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 ⇒ Object
20 21 22 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 20 def name @channels[0].name end |
#path ⇒ Object
15 16 17 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 15 def path @channels[0].path end |
#values ⇒ Object
35 36 37 |
# File 'lib/ruby_tdms/aggregate_channel.rb', line 35 def values @values ||= AggregateChannelEnumerator.new @channels end |