Class: Lens::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/lens/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Event

Returns a new instance of Event.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
# File 'lib/lens/event.rb', line 5

def initialize(options = {})
  raise ArgumentError unless all_params_present?(options)

  @name = options[:name]
  @time = options[:started]
  @end = options[:finished]
  @transaction_id = options[:transaction_id]
  @payload = options[:payload]
end

Instance Attribute Details

#endObject (readonly)

Returns the value of attribute end.



3
4
5
# File 'lib/lens/event.rb', line 3

def end
  @end
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/lens/event.rb', line 3

def name
  @name
end

#payloadObject (readonly)

Returns the value of attribute payload.



3
4
5
# File 'lib/lens/event.rb', line 3

def payload
  @payload
end

#timeObject (readonly)

Returns the value of attribute time.



3
4
5
# File 'lib/lens/event.rb', line 3

def time
  @time
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



3
4
5
# File 'lib/lens/event.rb', line 3

def transaction_id
  @transaction_id
end

Instance Method Details

#durationObject



15
16
17
# File 'lib/lens/event.rb', line 15

def duration
  1000.0 * (self.end - time)
end