Class: Igniter::Extensions::Contracts::Debug::ProfileSnapshot
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Debug::ProfileSnapshot
- Defined in:
- lib/igniter/extensions/contracts/debug/profile_snapshot.rb
Instance Attribute Summary collapse
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
-
#initialize(profile:) ⇒ ProfileSnapshot
constructor
A new instance of ProfileSnapshot.
- #pack_names ⇒ Object
- #packs ⇒ Object
- #registry_keys ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(profile:) ⇒ ProfileSnapshot
Returns a new instance of ProfileSnapshot.
12 13 14 15 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 12 def initialize(profile:) @profile = profile freeze end |
Instance Attribute Details
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
10 11 12 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 10 def profile @profile end |
Instance Method Details
#pack_names ⇒ Object
17 18 19 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 17 def pack_names profile.pack_names.sort end |
#packs ⇒ Object
21 22 23 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 21 def packs profile.pack_manifests.map { |manifest| PackSnapshot.new(manifest) } end |
#registry_keys ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 25 def registry_keys { node_kinds: profile.nodes.keys.sort, dsl_keywords: profile.dsl_keywords.keys.sort, validators: profile.validators.map(&:key).sort, normalizers: profile.normalizers.map(&:key).sort, runtime_handlers: profile.runtime_handlers.keys.sort, diagnostics_contributors: profile.diagnostics_contributors.map(&:key).sort, effects: profile.effects.keys.sort, executors: profile.executors.keys.sort } end |
#to_h ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/igniter/extensions/contracts/debug/profile_snapshot.rb', line 38 def to_h { fingerprint: profile.fingerprint, pack_names: pack_names, registry_keys: registry_keys, packs: packs.map(&:to_h) } end |