Class: Bundler::PubGrub::StaticPackageSource::DSL
- Inherits:
-
Object
- Object
- Bundler::PubGrub::StaticPackageSource::DSL
- Defined in:
- lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb
Instance Method Summary collapse
- #add(name, version, deps: {}) ⇒ Object
-
#initialize(packages, root_deps) ⇒ DSL
constructor
A new instance of DSL.
- #root(deps:) ⇒ Object
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
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 |