Class: RailsRequests::Record
- Inherits:
-
Object
- Object
- RailsRequests::Record
- Defined in:
- lib/rails_requests/record.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#datetime ⇒ Object
readonly
Returns the value of attribute datetime.
-
#datetimei ⇒ Object
readonly
Returns the value of attribute datetimei.
-
#metric ⇒ Object
readonly
Returns the value of attribute metric.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #controller_action ⇒ Object
-
#initialize(key, value) ⇒ Record
constructor
key = metrics|HomeController|index|20200123T0919|1579789173|/|database = 0 value = string.
- #value ⇒ Object
Constructor Details
#initialize(key, value) ⇒ Record
key = metrics|HomeController|index|20200123T0919|1579789173|/|database = 0 value = string
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_requests/record.rb', line 8 def initialize(key, value) @key = key @value = value items = key.split("|") @controller = items[1] @action = items[2] @datetime = items[3] @datetimei = items[4].to_i @path = items[5] @metric = items[6] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def action @action end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def controller @controller end |
#datetime ⇒ Object (readonly)
Returns the value of attribute datetime.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def datetime @datetime end |
#datetimei ⇒ Object (readonly)
Returns the value of attribute datetimei.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def datetimei @datetimei end |
#metric ⇒ Object (readonly)
Returns the value of attribute metric.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def metric @metric end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/rails_requests/record.rb', line 4 def path @path end |
Instance Method Details
#controller_action ⇒ Object
31 32 33 |
# File 'lib/rails_requests/record.rb', line 31 def controller_action "#{controller}##{action}" end |
#value ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rails_requests/record.rb', line 22 def value case metric when "database", "view_duration", "total_duration" @value.to_f when "all" JSON.parse(@value) end end |