Class: Inventory::Dependencies

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

Defined Under Namespace

Classes: Development, Optional, Runtime

Instance Method Summary collapse

Constructor Details

#initialize(*dependencies) ⇒ Dependencies

Returns a new instance of Dependencies.



6
7
8
9
# File 'lib/inventory/dependencies.rb', line 6

def initialize(*dependencies)
  @dependencies = dependencies
  instance_exec(&Proc.new) if block_given?
end

Instance Method Details

#+(other) ⇒ Object



11
12
13
# File 'lib/inventory/dependencies.rb', line 11

def +(other)
  self.class.new(*(dependencies + other.dependencies))
end

#add_to_gem_specification(specification) ⇒ Object



27
28
29
30
31
32
# File 'lib/inventory/dependencies.rb', line 27

def add_to_gem_specification(specification)
  each do |dependency|
    dependency.add_to_gem_specification specification
  end
  self
end

#eachObject



15
16
17
18
19
20
21
# File 'lib/inventory/dependencies.rb', line 15

def each
  return enum_for(__method__) unless block_given?
  dependencies.each do |dependency|
    yield dependency
  end
  self
end

#requireObject



23
24
25
# File 'lib/inventory/dependencies.rb', line 23

def require
  map{ |dependency| dependency.require }
end