class TypeProf::Core::TypeAliasEntity - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::TypeAliasEntity

### Attributes

decls[R]
type[R]

### Public Class Methods

new() click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/type_alias_entity.rb, line 3
    def initialize
      @decls = Set[]
      @type = nil
    end

### Public Instance Methods

add_decl(decl) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/type_alias_entity.rb, line 14
    def add_decl(decl)
      @decls << decl
      @type = decl.type unless @type
      # TODO: report an error if there are duplicated declarations
    end

exist?() click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/type_alias_entity.rb, line 10
    def exist?
      !@decls.empty?
    end

remove_decl(decl) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/env/type_alias_entity.rb, line 20
    def remove_decl(decl)
      @decls.delete(decl) || raise
      if @type == decl.type
        @type = @decls.empty? ? nil : @decls.to_a.first.type
      end
    end