class RBS::Collection::Cleaner
属性
lock[R]
公共类方法
new(lockfile_path:) 点击切换源代码
# File rbs-3.8.0/lib/rbs/collection/cleaner.rb, line 8 def initialize(lockfile_path:) @lock = Config.from_path(lockfile_path) end
公共实例方法
clean() 点击切换源代码
# File rbs-3.8.0/lib/rbs/collection/cleaner.rb, line 12 def clean lock.repo_path.glob('*/*') do |dir| *_, gem_name, version = dir.to_s.split('/') gem_name or raise version or raise next if needed? gem_name, version case when dir.symlink? dir.unlink when dir.directory? FileUtils.remove_entry_secure(dir.to_s) else raise end end end
needed?(gem_name, version) 点击切换源代码
# File rbs-3.8.0/lib/rbs/collection/cleaner.rb, line 30 def needed?(gem_name, version) gem = lock.gem(gem_name) return false unless gem gem['version'] == version end