Class: Airbrake::Error
- Inherits:
-
Object
- Object
- Airbrake::Error
- Includes:
- DataMapper::Resource
- Defined in:
- lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
Class Method Summary collapse
-
.from_xml(xml) ⇒ Object
Given a block of XML returned from the Airbrake API, return an Airbrake::Error object.
Instance Method Summary collapse
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
7 8 9 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 7 def field @field end |
Class Method Details
.from_xml(xml) ⇒ Object
Given a block of XML returned from the Airbrake API, return an Airbrake::Error object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 11 def self.from_xml(xml) field = {} xml.xpath('./*').each do |node| content = node.content # convert to proper ruby types type = node.attributes['type'] && node.attributes['type'].value case type when "boolean" content = content == "true" when "datetime" content = Time.parse(content) when "integer" content = content.to_i end key = node.name.tr('-','_') field[key.to_sym] = content end error = new() error.field = field error.error_id = field[:id] return error end |
Instance Method Details
#[](key) ⇒ Object
38 39 40 41 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 38 def [](key) key = key.to_s.tr('-','_').to_sym @field[key] end |
#eql?(other) ⇒ Boolean
43 44 45 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 43 def eql?(other) self.error_id.eql?(other.error_id) end |
#hash ⇒ Object
47 48 49 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 47 def hash self.error_id.hash end |
#summary ⇒ Object
34 35 36 |
# File 'lib/campfire/polling_bot/plugins/airbrake/airbrake/error.rb', line 34 def summary "#{@field[:error_message]} at #{@field[:file]}:#{@field[:line_number]}" end |