class RBS::CLI::LibraryOptions
属性
config_path[读/写]
core_root[读/写]
dirs[只读]
libs[只读]
repos[只读]
公共类方法
new() 点击以切换源代码
# File rbs-3.8.0/lib/rbs/cli.rb, line 21 def initialize() @core_root = EnvironmentLoader::DEFAULT_CORE_ROOT @repos = [] @libs = [] @dirs = [] @config_path = Collection::Config.find_config_path || Collection::Config::PATH end
公共实例方法
loader() 点击以切换源代码
# File rbs-3.8.0/lib/rbs/cli.rb, line 30 def loader repository = Repository.new(no_stdlib: core_root.nil?) repos.each do |repo| repository.add(Pathname(repo)) end loader = EnvironmentLoader.new(core_root: core_root, repository: repository) if config_path lock_path = Collection::Config.to_lockfile_path(config_path) if lock_path.file? lock = Collection::Config::Lockfile.from_lockfile(lockfile_path: lock_path, data: YAML.load_file(lock_path.to_s)) end end loader.add_collection(lock) if lock dirs.each do |dir| loader.add(path: Pathname(dir)) end libs.each do |lib| name, version = lib.split(/:/, 2) next unless name loader.add(library: name, version: version) end loader end
setup_library_options(opts) 点击以切换源代码
# File rbs-3.8.0/lib/rbs/cli.rb, line 58 def setup_library_options(opts) opts.on("-r LIBRARY", "Load RBS files of the library") do |lib| libs << lib end opts.on("-I DIR", "Load RBS files from the directory") do |dir| dirs << dir end opts.on("--no-stdlib", "Skip loading standard library signatures") do self.core_root = nil end opts.on('--collection PATH', "File path of collection configuration (default: #{@config_path})") do |path| self.config_path = Pathname(path).expand_path end opts.on('--no-collection', 'Ignore collection configuration') do self.config_path = nil end opts.on("--repo DIR", "Add RBS repository") do |dir| repos << dir end opts end