Class: Igniter::Extensions::Contracts::Debug::PackSnapshot
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Debug::PackSnapshot
- Defined in:
- lib/igniter/extensions/contracts/debug/pack_snapshot.rb
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
-
#initialize(manifest) ⇒ PackSnapshot
constructor
A new instance of PackSnapshot.
- #metadata ⇒ Object
- #name ⇒ Object
- #node_kinds ⇒ Object
- #registry_contracts ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(manifest) ⇒ PackSnapshot
Returns a new instance of PackSnapshot.
10 11 12 13 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 10 def initialize(manifest) @manifest = manifest freeze end |
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
8 9 10 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 8 def manifest @manifest end |
Instance Method Details
#metadata ⇒ Object
19 20 21 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 19 def manifest. end |
#name ⇒ Object
15 16 17 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 15 def name manifest.name end |
#node_kinds ⇒ Object
23 24 25 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 23 def node_kinds manifest.node_contracts.map(&:kind) end |
#registry_contracts ⇒ Object
27 28 29 30 31 32 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 27 def registry_contracts manifest.registry_contracts.each_with_object({}) do |contract, memo| memo[contract.registry] ||= [] memo[contract.registry] << contract.key end.transform_values(&:sort) end |
#to_h ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 34 def to_h { name: name, metadata: , node_kinds: node_kinds, registry_contracts: registry_contracts } end |