Class: Honeybadger::Breadcrumbs::Breadcrumb
- Inherits:
-
Object
- Object
- Honeybadger::Breadcrumbs::Breadcrumb
- Includes:
- Comparable
- Defined in:
- lib/honeybadger/breadcrumbs/breadcrumb.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#category ⇒ Object
readonly
Raw breadcrumb data structure.
-
#message ⇒ Object
Returns the value of attribute message.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#timestamp ⇒ Object
readonly
Raw breadcrumb data structure.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#active? ⇒ Boolean
Is the Breadcrumb active or not.
-
#ignore! ⇒ Object
Sets the breadcrumb to inactive.
-
#initialize(category: "custom", message: nil, metadata: {}) ⇒ Breadcrumb
constructor
A new instance of Breadcrumb.
- #to_h ⇒ Object
Constructor Details
#initialize(category: "custom", message: nil, metadata: {}) ⇒ Breadcrumb
Returns a new instance of Breadcrumb.
13 14 15 16 17 18 19 20 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 13 def initialize(category: "custom", message: nil, metadata: {}) @active = true @timestamp = Time.now.utc @category = category @message = @metadata = .is_a?(Hash) ? : {} end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
9 10 11 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 9 def active @active end |
#category ⇒ Object (readonly)
Raw breadcrumb data structure
8 9 10 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 8 def category @category end |
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 9 def @message end |
#metadata ⇒ Object
Returns the value of attribute metadata.
9 10 11 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 9 def @metadata end |
#timestamp ⇒ Object (readonly)
Raw breadcrumb data structure
8 9 10 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 8 def @timestamp end |
Instance Method Details
#<=>(other) ⇒ Object
31 32 33 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 31 def <=>(other) to_h <=> other.to_h end |
#active? ⇒ Boolean
Is the Breadcrumb active or not. Inactive Breadcrumbs not be included with any outgoing payloads.
40 41 42 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 40 def active? @active end |
#ignore! ⇒ Object
Sets the breadcrumb to inactive
47 48 49 50 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 47 def ignore! @active = false self end |
#to_h ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/honeybadger/breadcrumbs/breadcrumb.rb', line 22 def to_h { category: category, message: , metadata: , timestamp: .iso8601(3) } end |