Class: Igniter::Extensions::Contracts::Debug::PackSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/debug/pack_snapshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#manifestObject (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

#metadataObject



19
20
21
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 19

def 
  manifest.
end

#nameObject



15
16
17
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 15

def name
  manifest.name
end

#node_kindsObject



23
24
25
# File 'lib/igniter/extensions/contracts/debug/pack_snapshot.rb', line 23

def node_kinds
  manifest.node_contracts.map(&:kind)
end

#registry_contractsObject



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_hObject



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