Class: Trainspotter::Ingest::Line

Inherits:
Object
  • Object
show all
Defined in:
app/jobs/trainspotter/ingest/line.rb

Constant Summary collapse

TYPES =
i[request_start processing params sql render request_end other].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw:, type: :other, timestamp: nil, metadata: {}) ⇒ Line

Returns a new instance of Line.



8
9
10
11
12
13
# File 'app/jobs/trainspotter/ingest/line.rb', line 8

def initialize(raw:, type: :other, timestamp: nil, metadata: {})
  @raw = raw
  @type = type
  @timestamp = timestamp
   = 
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'app/jobs/trainspotter/ingest/line.rb', line 6

def 
  
end

#rawObject (readonly)

Returns the value of attribute raw.



6
7
8
# File 'app/jobs/trainspotter/ingest/line.rb', line 6

def raw
  @raw
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'app/jobs/trainspotter/ingest/line.rb', line 6

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'app/jobs/trainspotter/ingest/line.rb', line 6

def type
  @type
end

Instance Method Details

#duration_msObject



39
40
41
# File 'app/jobs/trainspotter/ingest/line.rb', line 39

def duration_ms
  [:duration_ms]
end

#params?Boolean

Returns:



35
36
37
# File 'app/jobs/trainspotter/ingest/line.rb', line 35

def params?
  type == :params
end

#processing?Boolean

Returns:



31
32
33
# File 'app/jobs/trainspotter/ingest/line.rb', line 31

def processing?
  type == :processing
end

#render?Boolean

Returns:



19
20
21
# File 'app/jobs/trainspotter/ingest/line.rb', line 19

def render?
  type == :render
end

#request_end?Boolean

Returns:



27
28
29
# File 'app/jobs/trainspotter/ingest/line.rb', line 27

def request_end?
  type == :request_end
end

#request_start?Boolean

Returns:



23
24
25
# File 'app/jobs/trainspotter/ingest/line.rb', line 23

def request_start?
  type == :request_start
end

#sql?Boolean

Returns:



15
16
17
# File 'app/jobs/trainspotter/ingest/line.rb', line 15

def sql?
  type == :sql
end