Class: Medicine::Dependencies Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/medicine/dependencies.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeDependencies

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Dependencies.



12
13
14
# File 'lib/medicine/dependencies.rb', line 12

def initialize
  @dependencies = []
end

Instance Method Details

#<<(dependency) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/medicine/dependencies.rb', line 44

def <<(dependency)
  push(dependency)
end

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/medicine/dependencies.rb', line 32

def [](name)
  find { |dependency| dependency.name == name }
end

#add(name, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/medicine/dependencies.rb', line 48

def add(name, options = {})
  push(Dependency.new(name, options))
end

#allObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/medicine/dependencies.rb', line 16

def all
  @dependencies
end

#each(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/medicine/dependencies.rb', line 20

def each(&block)
  all.each(&block)
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


24
25
26
# File 'lib/medicine/dependencies.rb', line 24

def empty?
  all.empty?
end

#fetch(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/medicine/dependencies.rb', line 36

def fetch(name)
  self[name] || raise(UnknownDependency, "Dependency #{name} is unknown")
end

#include?(name) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


40
41
42
# File 'lib/medicine/dependencies.rb', line 40

def include?(name)
  !!self[name]
end

#push(dependency) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/medicine/dependencies.rb', line 52

def push(dependency)
  all.push(dependency)
end

#sizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/medicine/dependencies.rb', line 28

def size
  all.size
end

#without_defaultObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



56
57
58
# File 'lib/medicine/dependencies.rb', line 56

def without_default
  reject(&:default?)
end