Class: Necropsy::Reachability::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/necropsy/reachability/engine.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_paths:, test_paths:, external_paths: {}) ⇒ Result

Returns a new instance of Result.



19
20
21
# File 'lib/necropsy/reachability/engine.rb', line 19

def initialize(runtime_paths:, test_paths:, external_paths: {})
  super
end

Instance Attribute Details

#external_pathsObject (readonly)

Returns the value of attribute external_paths

Returns:

  • (Object)

    the current value of external_paths



5
6
7
# File 'lib/necropsy/reachability/engine.rb', line 5

def external_paths
  @external_paths
end

#runtime_pathsObject (readonly)

Returns the value of attribute runtime_paths

Returns:

  • (Object)

    the current value of runtime_paths



5
6
7
# File 'lib/necropsy/reachability/engine.rb', line 5

def runtime_paths
  @runtime_paths
end

#test_pathsObject (readonly)

Returns the value of attribute test_paths

Returns:

  • (Object)

    the current value of test_paths



5
6
7
# File 'lib/necropsy/reachability/engine.rb', line 5

def test_paths
  @test_paths
end

Class Method Details

.data_newObject



7
# File 'lib/necropsy/reachability/engine.rb', line 7

alias_method :data_new, :new

.new(*values, **attributes) ⇒ Object Also known as: []



9
10
11
12
13
# File 'lib/necropsy/reachability/engine.rb', line 9

def new(*values, **attributes)
  return data_new(runtime_paths: values[0], test_paths: values[1], external_paths: {}) if values.length == 2 && attributes.empty?

  data_new(*values, **attributes)
end

Instance Method Details

#external_aliveObject



31
32
33
# File 'lib/necropsy/reachability/engine.rb', line 31

def external_alive
  external_paths.keys
end

#runtime_aliveObject



23
24
25
# File 'lib/necropsy/reachability/engine.rb', line 23

def runtime_alive
  runtime_paths.keys
end

#test_aliveObject



27
28
29
# File 'lib/necropsy/reachability/engine.rb', line 27

def test_alive
  test_paths.keys
end

#witness(node_id, kind: :runtime) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/necropsy/reachability/engine.rb', line 35

def witness(node_id, kind: :runtime)
  paths = paths_for(kind)
  return unless paths.key?(node_id)

  chain = []
  current = node_id
  while current
    chain.unshift(current)
    current = paths[current]
  end
  chain
end