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.
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
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 |