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.
-
#inline_source_pattern ⇒ Object
readonly
Returns the value of attribute inline_source_pattern.
-
#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:, inline_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_inline_source_file?(path) ⇒ Boolean
- #possible_signature_file?(path) ⇒ Boolean
- #possible_source_file?(path) ⇒ Boolean
Constructor Details
#initialize(name:, options:, source_pattern:, inline_source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:) ⇒ Target
Returns a new instance of Target.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/steep/project/target.rb', line 16 def initialize(name:, options:, source_pattern:, inline_source_pattern:, signature_pattern:, code_diagnostics_config:, project:, unreferenced:, implicitly_returns_nil:) @name = name @target_options = @source_pattern = source_pattern @inline_source_pattern = inline_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.
10 11 12 |
# File 'lib/steep/project/target.rb', line 10 def code_diagnostics_config @code_diagnostics_config end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
13 14 15 |
# File 'lib/steep/project/target.rb', line 13 def groups @groups end |
#implicitly_returns_nil ⇒ Object (readonly)
Returns the value of attribute implicitly_returns_nil.
14 15 16 |
# File 'lib/steep/project/target.rb', line 14 def implicitly_returns_nil @implicitly_returns_nil end |
#inline_source_pattern ⇒ Object (readonly)
Returns the value of attribute inline_source_pattern.
9 10 11 |
# File 'lib/steep/project/target.rb', line 9 def inline_source_pattern @inline_source_pattern 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.
11 12 13 |
# File 'lib/steep/project/target.rb', line 11 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.
12 13 14 |
# File 'lib/steep/project/target.rb', line 12 def unreferenced @unreferenced end |
Class Method Details
.construct_env_loader(options:, project:) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/steep/project/target.rb', line 73 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
69 70 71 |
# File 'lib/steep/project/target.rb', line 69 def new_env_loader() Target.construct_env_loader(options: , project: project) end |
#options ⇒ Object
29 30 31 |
# File 'lib/steep/project/target.rb', line 29 def || project. end |
#possible_inline_source_file?(path) ⇒ Boolean
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/steep/project/target.rb', line 57 def possible_inline_source_file?(path) if group = groups.find { _1.possible_inline_source_file?(path) } return group end if inline_source_pattern =~ path return self end nil end |
#possible_signature_file?(path) ⇒ Boolean
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/steep/project/target.rb', line 45 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
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/steep/project/target.rb', line 33 def possible_source_file?(path) if target = groups.find { _1.possible_source_file?(path) } return target end if source_pattern =~ path && inline_source_pattern !~ path return self end nil end |