Class: Igniter::Extensions::Contracts::Audit::Snapshot
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Audit::Snapshot
- Defined in:
- lib/igniter/extensions/contracts/audit/snapshot.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#event_count ⇒ Object
readonly
Returns the value of attribute event_count.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#output_names ⇒ Object
readonly
Returns the value of attribute output_names.
-
#profile_fingerprint ⇒ Object
readonly
Returns the value of attribute profile_fingerprint.
-
#states ⇒ Object
readonly
Returns the value of attribute states.
Instance Method Summary collapse
- #event_types ⇒ Object
-
#initialize(graph:, profile_fingerprint:, events:, states:, children:, output_names:) ⇒ Snapshot
constructor
A new instance of Snapshot.
- #state(name) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(graph:, profile_fingerprint:, events:, states:, children:, output_names:) ⇒ Snapshot
Returns a new instance of Snapshot.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 10 def initialize(graph:, profile_fingerprint:, events:, states:, children:, output_names:) @graph = graph.to_s @profile_fingerprint = profile_fingerprint @events = events.freeze @states = states.transform_keys(&:to_sym).freeze @children = children.freeze @output_names = output_names.map(&:to_sym).freeze @event_count = @events.length freeze end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def children @children end |
#event_count ⇒ Object (readonly)
Returns the value of attribute event_count.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def event_count @event_count end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def events @events end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def graph @graph end |
#output_names ⇒ Object (readonly)
Returns the value of attribute output_names.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def output_names @output_names end |
#profile_fingerprint ⇒ Object (readonly)
Returns the value of attribute profile_fingerprint.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def profile_fingerprint @profile_fingerprint end |
#states ⇒ Object (readonly)
Returns the value of attribute states.
8 9 10 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 8 def states @states end |
Instance Method Details
#event_types ⇒ Object
21 22 23 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 21 def event_types events.map(&:type).uniq end |
#state(name) ⇒ Object
25 26 27 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 25 def state(name) states.fetch(name.to_sym) end |
#to_h ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/igniter/extensions/contracts/audit/snapshot.rb', line 29 def to_h { graph: graph, profile_fingerprint: profile_fingerprint, event_count: event_count, output_names: output_names, events: events.map(&:to_h), states: states, children: children } end |