Class: Tracebin::Event

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/tracebin/events.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#deserialize_time_string, #milliseconds_between, #time_to_string, #timestamp_string, #to_milliseconds

Constructor Details

#initialize(event) ⇒ Event

Returns a new instance of Event.



9
10
11
# File 'lib/tracebin/events.rb', line 9

def initialize(event)
  @event = event
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



7
8
9
# File 'lib/tracebin/events.rb', line 7

def event
  @event
end

Instance Method Details

#data_hashObject



21
22
23
24
25
26
27
28
29
# File 'lib/tracebin/events.rb', line 21

def data_hash
  {
    event_type: type,
    start: time_to_string(event[1]),
    stop: time_to_string(event[2]),
    duration: milliseconds_between(event[2], event[1]),
    data: select_data || event.last
  }
end

#recorder_typeObject



13
14
15
# File 'lib/tracebin/events.rb', line 13

def recorder_type
  event[0]
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tracebin/events.rb', line 17

def valid?
  true
end