Class: StreamPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/cpee-logging-xes-yaml/tools.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ StreamPoint

Returns a new instance of StreamPoint.



7
8
9
10
11
12
13
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 7

def initialize(id)
  @id = id
  @value = nil
  @timestamp = Time.now
  @source = nil
  @meta = nil
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 5

def id
  @id
end

#metaObject

Returns the value of attribute meta.



4
5
6
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 4

def meta
  @meta
end

#sourceObject

Returns the value of attribute source.



4
5
6
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 4

def source
  @source
end

#timestampObject

Returns the value of attribute timestamp.



4
5
6
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 4

def timestamp
  @timestamp
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 4

def value
  @value
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
22
23
# File 'lib/cpee-logging-xes-yaml/tools.rb', line 15

def to_h
  tp = { }
  tp['stream:id'] = @id
  tp['stream:value'] = @value
  tp['stream:timestamp'] = @timestamp
  tp['stream:source'] = @source unless @source.nil?
  tp['stream:meta'] = @meta unless @meta.nil?
  tp
end