Module: Blood

Defined in:
lib/blood.rb,
lib/blood/version.rb

Defined Under Namespace

Classes: Node

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.source(mods) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/blood.rb', line 9

def self.source(mods)
  hier = Hash.new{ |h, k| h[k] = Set.new }
  mods.each do |mod|
    ances = mod.ancestors
    ances.each_with_index do |child, i|
      parent = ances[i + 1]
      hier[parent] << child
    end
  end
  Node.new(BasicObject, hier)
end