Class: CircuitBreaker::History::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/circuit_breaker/history.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, details:, actor_id: nil) ⇒ Entry

Returns a new instance of Entry.



6
7
8
9
10
11
# File 'lib/circuit_breaker/history.rb', line 6

def initialize(type:, details:, actor_id: nil)
  @timestamp = Time.now
  @type = type
  @details = details
  @actor_id = actor_id
end

Instance Attribute Details

#actor_idObject (readonly)

Returns the value of attribute actor_id.



4
5
6
# File 'lib/circuit_breaker/history.rb', line 4

def actor_id
  @actor_id
end

#detailsObject (readonly)

Returns the value of attribute details.



4
5
6
# File 'lib/circuit_breaker/history.rb', line 4

def details
  @details
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



4
5
6
# File 'lib/circuit_breaker/history.rb', line 4

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/circuit_breaker/history.rb', line 4

def type
  @type
end

Instance Method Details

#to_hObject



13
14
15
16
17
18
19
20
# File 'lib/circuit_breaker/history.rb', line 13

def to_h
  {
    timestamp: timestamp,
    type: type,
    details: details,
    actor_id: actor_id
  }
end