class RBS::Collection::Config
This class represent the configuration file.
This class represent the configuration file.
Constants
- PATH
Attributes
data
[R]
untyped
Public Class Methods
() → Pathname?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 21 def self.find_config_path current = Pathname.pwd loop do config_path = current.join(PATH) return config_path if config_path.exist? current = current.join('..') return nil if current.root? end end
(Pathname path) → Config
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 41 def self.from_path(path) new(YAML.load(path.read), config_path: path) end
(config_path: Pathname, definition: Bundler::Definition, ?with_lockfile: boolish) → [ Config, Lockfile ]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 34 def self.generate_lockfile(config_path:, definition:, with_lockfile: true) config = from_path(config_path) lockfile = LockfileGenerator.generate(config: config, definition: definition, with_lockfile: with_lockfile) [config, lockfile] end
Generate a rbs lockfile from Gemfile.lock to config_path. If with_lockfile is true, it respects existing rbs lockfile.
(untyped data, config_path: Pathname) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 49 def initialize(data, config_path:) @data = data @config_path = config_path end
config_path is necessary to resolve relative repo_path
Public Instance Methods
(String gem_name) → gem_entry?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 54 def gem(gem_name) gems.find { |gem| gem['name'] == gem_name } end
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 74 def gems @data['gems'] ||= ( [] #: Array[gem_entry] ) end
() → Pathname
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 58 def repo_path @config_path.dirname.join repo_path_data end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 62 def repo_path_data Pathname(@data["path"]) end
() → Array[Sources::t]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/collection/config.rb, line 66 def sources @sources ||= [ Sources::Rubygems.instance, *@data['sources'].map { |c| Sources.from_config_entry(c, base_directory: @config_path.dirname) }, Sources::Stdlib.instance ] end