Class: Chordate::Error
- Inherits:
-
Object
- Object
- Chordate::Error
- Defined in:
- lib/chordate-ruby/error.rb
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(*args) ⇒ Error
constructor
A new instance of Error.
- #merge!(other) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Error
Returns a new instance of Error.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/chordate-ruby/error.rb', line 3 def initialize(*args) @ex = args.shift @json = { :env => Chordate.config.env, :generated_at => Time.now, :klass => @ex.class.name, :message => @ex., :backtrace => @ex.backtrace, :server => Chordate.config.server } merge!(args.shift) end |
Instance Method Details
#as_json ⇒ Object
26 27 28 |
# File 'lib/chordate-ruby/error.rb', line 26 def as_json(*) @json end |
#merge!(other) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/chordate-ruby/error.rb', line 18 def merge!(other) other.each do |(k, v)| v.nil? ? @json.delete(k) : @json[k] = v end self end |