Sha256: c3390b87511a9fa8b754fa830749f719242ea615ed767488711caa4a48488e3f
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'rbs' module Yoda module Model module TypeExpressions class InstanceType < Base # @return [ScopedPath] attr_reader :path # @param value [String, Path, ScopedPath] def initialize(path) @path = ScopedPath.build(path) end # @param another [Object] def eql?(another) another.is_a?(InstanceType) && path == another.path end def hash [self.class.name, path].hash end # @param paths [LexicalContext] # @return [self] def change_root(paths) self.class.new(path.change_scope(paths)) end # @param registry [Registry] # @return [Array<Store::Objects::Base>] def resolve(registry) [Store::Query::FindConstant.new(registry).find(path)].compact end # @return [String] def to_s path.path.to_s end # @param env [Environment] def to_rbs_type(env) name = env.resolve_rbs_type_name(path) name ? RBS::Types::ClassInstance.new(name: name, args: [], location: nil) : RBS::Types::Bases::Any.new(location: nil) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems