Sha256: 57ff1d9434c8f834088cbeb819a4c16394c75b5d0ab31778c5712aacbb53131c

Contents?: true

Size: 947 Bytes

Versions: 8

Compression:

Stored size: 947 Bytes

Contents

module Yoda
  module Model
    module Types
      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 [Array<Path>]
        # @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
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
yoda-language-server-0.7.2 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.7.1 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.7.0 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.6.2 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.6.1 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.6.0 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.5.0 lib/yoda/model/types/instance_type.rb
yoda-language-server-0.4.0 lib/yoda/model/types/instance_type.rb