Sha256: 10123bbb4ec541d40ca7ad53d5bac475217ad91f7fc767efd931e4f676c0b9bd
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
module Steep class Project attr_reader :targets attr_reader :steepfile_path def initialize(steepfile_path:) @targets = [] @steepfile_path = steepfile_path unless steepfile_path.absolute? raise "Project#initialize(steepfile_path:): steepfile_path should be absolute path" end end def base_dir steepfile_path.parent end def relative_path(path) path.relative_path_from(base_dir) end def absolute_path(path) (base_dir + path).cleanpath end def target_for_source_path(path) targets.find do |target| target.possible_source_file?(path) end end def targets_for_path(path) if target = target_for_source_path(path) [target, []] else [ nil, targets.select do |target| target.possible_signature_file?(path) end ] end end def all_source_files targets.each.with_object(Set[]) do |target, paths| paths.merge(target.source_files.keys) end end def all_signature_files targets.each.with_object(Set[]) do |target, paths| paths.merge(target.signature_files.keys) end end def type_of_node(path:, line:, column:) source_file = targets.map {|target| target.source_files[path] }.compact[0] if source_file case (status = source_file.status) when SourceFile::TypeCheckStatus node = status.source.find_node(line: line, column: column) type = begin status.typing.type_of(node: node) rescue RuntimeError AST::Builtin.any_type end if block_given? yield type, node else type end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
steep-0.41.0 | lib/steep/project.rb |