class Medicine::Dependencies

@api private

Public Class Methods

new() click to toggle source
# File lib/medicine/dependencies.rb, line 12
def initialize
  @dependencies = []
end

Public Instance Methods

<<(dependency) click to toggle source
# File lib/medicine/dependencies.rb, line 44
def <<(dependency)
  push(dependency)
end
[](name) click to toggle source
# File lib/medicine/dependencies.rb, line 32
def [](name)
  find { |dependency| dependency.name == name }
end
add(name, options = {}) click to toggle source
# File lib/medicine/dependencies.rb, line 48
def add(name, options = {})
  push(Dependency.new(name, options))
end
all() click to toggle source
# File lib/medicine/dependencies.rb, line 16
def all
  @dependencies
end
each(&block) click to toggle source
# File lib/medicine/dependencies.rb, line 20
def each(&block)
  all.each(&block)
end
empty?() click to toggle source
# File lib/medicine/dependencies.rb, line 24
def empty?
  all.empty?
end
fetch(name) click to toggle source
# File lib/medicine/dependencies.rb, line 36
def fetch(name)
  self[name] || raise(UnknownDependency, "Dependency #{name} is unknown")
end
include?(name) click to toggle source
# File lib/medicine/dependencies.rb, line 40
def include?(name)
  !!self[name]
end
push(dependency) click to toggle source
# File lib/medicine/dependencies.rb, line 52
def push(dependency)
  all.push(dependency)
end
size() click to toggle source
# File lib/medicine/dependencies.rb, line 28
def size
  all.size
end
without_default() click to toggle source
# File lib/medicine/dependencies.rb, line 56
def without_default
  reject(&:default?)
end