Class: Bundler::PubGrub::StaticPackageSource

Inherits:
BasicPackageSource show all
Defined in:
lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb

Defined Under Namespace

Classes: DSL

Instance Method Summary collapse

Methods inherited from BasicPackageSource

#incompatibilities_for, #no_versions_incompatibility_for, #sort_versions_by_preferred, #versions_for

Constructor Details

#initialize {|DSL.new(@packages, @root_deps)| ... } ⇒ StaticPackageSource

Returns a new instance of StaticPackageSource.

Yields:

  • (DSL.new(@packages, @root_deps))


34
35
36
37
38
39
40
41
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 34

def initialize
  @root_deps = {}
  @packages = {}

  yield DSL.new(@packages, @root_deps)

  super()
end

Instance Method Details

#all_versions_for(package) ⇒ Object



43
44
45
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 43

def all_versions_for(package)
  @packages[package].keys
end

#dependencies_for(package, version) ⇒ Object



51
52
53
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 51

def dependencies_for(package, version)
  @packages[package][version]
end

#parse_dependency(package, dependency) ⇒ Object



55
56
57
58
59
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 55

def parse_dependency(package, dependency)
  return false unless @packages.key?(package)

  Bundler::PubGrub::RubyGems.parse_constraint(package, dependency)
end

#root_dependenciesObject



47
48
49
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 47

def root_dependencies
  @root_deps
end