Created
March 16, 2018 22:23
-
-
Save cassioKenji/63cb381ac7e9b717b1c7b22e63d8f185 to your computer and use it in GitHub Desktop.
objeto que guarda metricas analiticas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
require 'json' | |
class Event < Hash | |
def initialize(status, code, measurements, exception=nil) | |
self[:status] = false | |
self[:code] = code | |
self[:measurements] = measurements | |
self[:type_test] = false | |
self[:exception] = {} | |
end | |
def is_success? | |
return true if self[:status].eql? "success" | |
end | |
def add_measure | |
end | |
def add_exception(e_class, e_message, e_backtrace) | |
self[:status] = false | |
self[:code] = "NonHTTP" | |
self[:exception] = {:e_class => e_class, | |
:e_message => e_message, | |
:e_backtrace => e_backtrace} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment