Module: Cell::Dependencies

Extended by:
Dependencies
Included in:
Dependencies
Defined in:
lib/cell/dependencies.rb,
lib/cell/dependencies/version.rb

Defined Under Namespace

Modules: TotalOrder

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#dependencies(seen = Set.new([self])) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cell/dependencies.rb', line 18

def dependencies(seen = Set.new([self]))
  @dependencies ||= []
  resolved = @dependencies.map {|n| Cell::Base.class_from_cell_name(n)}
  resolved.inject(resolved) do |all, dep|
    if seen.include?(dep)
      all
    else
      seen << dep
      dep.dependencies(seen) - [self] + all
    end
  end
end

#inherited(cls) ⇒ Object



8
9
10
11
# File 'lib/cell/dependencies.rb', line 8

def inherited(cls)
  super
  cls.extend(Cell::Dependencies)
end

#uses(*names) ⇒ Object



13
14
15
16
# File 'lib/cell/dependencies.rb', line 13

def uses(*names)
  @dependencies ||= [] 
  @dependencies += names
end