Class: Bundler::PubGrub::StaticPackageSource::DSL

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

Instance Method Summary collapse

Constructor Details

#initialize(packages, root_deps) ⇒ DSL

Returns a new instance of DSL.



10
11
12
13
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 10

def initialize(packages, root_deps)
  @packages = packages
  @root_deps = root_deps
end

Instance Method Details

#add(name, version, deps: {}) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 19

def add(name, version, deps: {})
  version = Gem::Version.new(version)
  @packages[name] ||= {}
  raise ArgumentError, "#{name} #{version} declared twice" if @packages[name].key?(version)
  @packages[name][version] = clean_deps(name, version, deps)
end

#root(deps:) ⇒ Object



15
16
17
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 15

def root(deps:)
  @root_deps.update(deps)
end