Class: Rigor::Effects::EffectTable

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rigor/effects/effect_table.rb

Overview

The whole-project effect graph after propagation: every method key the run collected, with its direct summary and its transitive closure (ADR-103 WD12).

An EffectTable is not a diagnostic and never enters rigor check's stream. It hangs off the runner for the report of this slice and the snapshot of #381 to read, exactly as ADR-102 draws the report-versus-diagnostic line.

Defined Under Namespace

Classes: Entry

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ EffectTable

Returns a new instance of EffectTable.

Parameters:

  • entries (Hash{String => Entry})


65
66
67
68
# File 'lib/rigor/effects/effect_table.rb', line 65

def initialize(entries)
  @entries = entries.sort_by { |key, _| key }.to_h.freeze
  freeze
end

Class Method Details

.emptyObject



60
61
62
# File 'lib/rigor/effects/effect_table.rb', line 60

def self.empty
  @empty ||= new(EMPTY_ENTRIES)
end

Instance Method Details

#[](key) ⇒ Object



70
71
72
# File 'lib/rigor/effects/effect_table.rb', line 70

def [](key)
  @entries[key]
end

#eachObject



78
79
80
# File 'lib/rigor/effects/effect_table.rb', line 78

def each(&)
  @entries.each_value(&)
end

#empty?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/rigor/effects/effect_table.rb', line 87

def empty?
  @entries.empty?
end

#keysObject



74
75
76
# File 'lib/rigor/effects/effect_table.rb', line 74

def keys
  @entries.keys
end

#sizeObject



83
84
85
# File 'lib/rigor/effects/effect_table.rb', line 83

def size
  @entries.size
end