Class: Steep::Project::Target
Instance Attribute Summary collapse
-
#code_diagnostics_config ⇒ Object
readonly
Returns the value of attribute code_diagnostics_config.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#implicitly_returns_nil ⇒ Object
readonly
Returns the value of attribute implicitly_returns_nil.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#signature_pattern ⇒ Object
readonly
Returns the value of attribute signature_pattern.
-
#source_pattern ⇒ Object
readonly
Returns the value of attribute source_pattern.
-
#target_options ⇒ Object
readonly
Returns the value of attribute target_options.
-
#unreferenced ⇒ Object
readonly
Returns the value of attribute unreferenced.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, options:, source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:) ⇒ Target
constructor
A new instance of Target.
- #new_env_loader ⇒ Object
- #options ⇒ Object
- #possible_signature_file?(path) ⇒ Boolean
- #possible_source_file?(path) ⇒ Boolean
Constructor Details
#initialize(name:, options:, source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:) ⇒ Target
Returns a new instance of Target.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/steep/project/target.rb', line 15 def initialize(name:, options:, source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:) @name = name @target_options = @source_pattern = source_pattern @signature_pattern = signature_pattern @code_diagnostics_config = code_diagnostics_config @project = project @unreferenced = unreferenced @groups = [] @implicitly_returns_nil = implicitly_returns_nil end |
Instance Attribute Details
#code_diagnostics_config ⇒ Object (readonly)
Returns the value of attribute code_diagnostics_config.
9 10 11 |
# File 'lib/steep/project/target.rb', line 9 def code_diagnostics_config @code_diagnostics_config end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
12 13 14 |
# File 'lib/steep/project/target.rb', line 12 def groups @groups end |
#implicitly_returns_nil ⇒ Object (readonly)
Returns the value of attribute implicitly_returns_nil.
13 14 15 |
# File 'lib/steep/project/target.rb', line 13 def implicitly_returns_nil @implicitly_returns_nil end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/steep/project/target.rb', line 4 def name @name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/steep/project/target.rb', line 10 def project @project end |
#signature_pattern ⇒ Object (readonly)
Returns the value of attribute signature_pattern.
8 9 10 |
# File 'lib/steep/project/target.rb', line 8 def signature_pattern @signature_pattern end |
#source_pattern ⇒ Object (readonly)
Returns the value of attribute source_pattern.
7 8 9 |
# File 'lib/steep/project/target.rb', line 7 def source_pattern @source_pattern end |
#target_options ⇒ Object (readonly)
Returns the value of attribute target_options.
5 6 7 |
# File 'lib/steep/project/target.rb', line 5 def @target_options end |
#unreferenced ⇒ Object (readonly)
Returns the value of attribute unreferenced.
11 12 13 |
# File 'lib/steep/project/target.rb', line 11 def unreferenced @unreferenced end |
Class Method Details
.construct_env_loader(options:, project:) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/steep/project/target.rb', line 59 def self.construct_env_loader(options:, project:) repo = RBS::Repository.new(no_stdlib: .paths.customized_stdlib?) if .paths.stdlib_root repo.add(project.absolute_path(.paths.stdlib_root)) end .paths.repo_paths.each do |path| repo.add(project.absolute_path(path)) end core_root_path = if .paths.customized_core? if .paths.core_root project.absolute_path(.paths.core_root) end else RBS::EnvironmentLoader::DEFAULT_CORE_ROOT end loader = RBS::EnvironmentLoader.new(core_root: core_root_path, repository: repo) .libraries.each do |lib| name, version = lib.split(/:/, 2) name or raise loader.add(library: name, version: version) end loader.add_collection(.collection_lock) if .collection_lock loader end |
Instance Method Details
#new_env_loader ⇒ Object
55 56 57 |
# File 'lib/steep/project/target.rb', line 55 def new_env_loader() Target.construct_env_loader(options: , project: project) end |
#options ⇒ Object
27 28 29 |
# File 'lib/steep/project/target.rb', line 27 def || project. end |
#possible_signature_file?(path) ⇒ Boolean
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/steep/project/target.rb', line 43 def possible_signature_file?(path) if target = groups.find { _1.possible_signature_file?(path) } return target end if signature_pattern =~ path return self end nil end |
#possible_source_file?(path) ⇒ Boolean
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/steep/project/target.rb', line 31 def possible_source_file?(path) if target = groups.find { _1.possible_source_file?(path) } return target end if source_pattern =~ path return self end nil end |