class Bundler::PubGrub::StaticPackageSource::DSL
公共类方法
new(packages, root_deps) 点击切换源代码
# File 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
公共实例方法
add(name, version, deps: {}) 点击切换源代码
# File 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:) 点击切换源代码
# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 15 def root(deps:) @root_deps.update(deps) end
私有实例方法
clean_deps(name, version, deps) 点击切换源代码
排除冗余的自引用依赖
# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 29 def clean_deps(name, version, deps) deps.reject {|dep_name, req| name == dep_name && Bundler::PubGrub::RubyGems.parse_range(req).include?(version) } end