Class: RailsPerformance::Models::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_performance/models/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Record

key = performance| controller|HomeController| action|index| format|html| status|200| datetime|20200124T0523| datetimei|1579861423| method|GET| path|/| request_id|454545454545454545| END

RailsPerformance::Models::Record.“view_runtime”:8.444603008683771,“db_runtime”:0,“duration”:9“view_runtime”:8.444603008683771,“db_runtime”:0,“duration”:9.216095000000001

value = JSON



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rails_performance/models/record.rb', line 19

def initialize(key, value)
  @json = value

  items = key.split("|")

  @controller = items[2]
  @action     = items[4]
  @format     = items[6]
  @status     = items[8]
  @datetime   = items[10]
  @datetimei  = items[12]
  @method     = items[14]
  @path       = items[16]
  @request_id = items[18]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def controller
  @controller
end

#datetimeObject (readonly)

Returns the value of attribute datetime.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def datetime
  @datetime
end

#datetimeiObject (readonly)

Returns the value of attribute datetimei.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def datetimei
  @datetimei
end

#formatObject (readonly)

Returns the value of attribute format.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def format
  @format
end

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def path
  @path
end

#request_idObject (readonly)

Returns the value of attribute request_id.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def request_id
  @request_id
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/rails_performance/models/record.rb', line 4

def status
  @status
end

Instance Method Details

#controller_actionObject



39
40
41
# File 'lib/rails_performance/models/record.rb', line 39

def controller_action
  "#{controller}##{action}"
end

#controller_action_formatObject



43
44
45
# File 'lib/rails_performance/models/record.rb', line 43

def controller_action_format
  "#{controller}##{action}|#{format}"
end

#valueObject



35
36
37
# File 'lib/rails_performance/models/record.rb', line 35

def value
  @value ||= JSON.parse(@json || "{}")
end