Class: Stream
- Inherits:
-
Object
- Object
- Stream
- Defined in:
- lib/cpee-logging-xes-yaml/tools.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #<<(val) ⇒ Object
-
#initialize(name) ⇒ Stream
constructor
A new instance of Stream.
- #to_list ⇒ Object
Constructor Details
#initialize(name) ⇒ Stream
Returns a new instance of Stream.
45 46 47 48 49 50 51 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 45 def initialize(name) @name = name @id = nil @source = nil @meta = nil @values = [] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
42 43 44 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 42 def id @id end |
#meta ⇒ Object
Returns the value of attribute meta.
42 43 44 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 42 def @meta end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
43 44 45 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 43 def name @name end |
#source ⇒ Object
Returns the value of attribute source.
42 43 44 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 42 def source @source end |
Instance Method Details
#<<(val) ⇒ Object
53 54 55 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 53 def <<(val) @values << val end |
#to_list ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 57 def to_list tp = [] tp << {'stream:name' => @name} tp << {'stream:id' => @id} unless @id.nil? tp << {'stream:source' => @source} unless @source.nil? tp << {'stream:meta' => @meta} unless @meta.nil? @values.each do |e| if e.is_a? Stream e.source = @source if e.source.nil? && !@source.nil? tp << { 'stream:datastream' => e.to_list } elsif e.is_a? StreamPoint e.source = @source if e.source.nil? && !@source.nil? tp << { 'stream:point' => e.to_h } end end tp end |