Class: RubyTDMS::Objects::Base
- Inherits:
-
Object
- Object
- RubyTDMS::Objects::Base
- Defined in:
- lib/ruby_tdms/objects/base.rb
Overview
TDMS object base. All objects hold a collection of Segment references since objects can be striped across segments.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#segment ⇒ Object
readonly
Returns the value of attribute segment.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #as_json ⇒ Object
- #continue_stream(stream, previous_channel) ⇒ Object
-
#initialize(path, document, segment) ⇒ Base
constructor
A new instance of Base.
- #parse_stream(stream) ⇒ Object
Constructor Details
#initialize(path, document, segment) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 |
# 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 |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/ruby_tdms/objects/base.rb', line 6 def path @path end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
6 7 8 |
# File 'lib/ruby_tdms/objects/base.rb', line 6 def properties @properties end |
#segment ⇒ Object (readonly)
Returns the value of attribute segment.
6 7 8 |
# File 'lib/ruby_tdms/objects/base.rb', line 6 def segment @segment end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
6 7 8 |
# File 'lib/ruby_tdms/objects/base.rb', line 6 def stream @stream end |
Instance Method Details
#as_json ⇒ Object
29 30 31 32 33 34 |
# 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) ⇒ Object
19 20 21 |
# File 'lib/ruby_tdms/objects/base.rb', line 19 def continue_stream(stream, previous_channel) parse_properties stream end |
#parse_stream(stream) ⇒ Object
24 25 26 |
# File 'lib/ruby_tdms/objects/base.rb', line 24 def parse_stream(stream) parse_properties stream end |