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.



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

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

Instance Method Details

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

Raises:

  • (ArgumentError)


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

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



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

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