class RBS::Definition::Method::TypeDef - rbs: Ruby Standard Library Documentation

# class RBS::Definition::Method::TypeDef

### Attributes

annotations[R]
defined_in[R]
implemented_in[R]
member[R]
member_annotations[R]
overload_annotations[R]
type[R]

### Public Class Methods

new(type:, member:, defined_in:, implemented_in:, overload_annotations: []) click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 35
    def initialize(type:, member:, defined_in:, implemented_in:, overload_annotations: [])
      @type = type
      @member = member
      @defined_in = defined_in
      @implemented_in = implemented_in
      @member_annotations = member.annotations
      @overload_annotations = overload_annotations
      @annotations = member.annotations + overload_annotations
    end

### Public Instance Methods

==(other) click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 45
    def ==(other)
      other.is_a?(TypeDef) &&
        other.type == type &&
        other.member == member &&
        other.defined_in == defined_in &&
        other.implemented_in == implemented_in
    end

Also aliased as: eql?
comment() click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 59
    def comment
      member.comment
    end

eql?(other)
Alias for: ==
hash() click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 55
    def hash
      self.class.hash ^ type.hash ^ member.hash ^ defined_in.hash ^ implemented_in.hash
    end

overload?() click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 67
    def overload?
      case mem = member
      when AST::Members::MethodDefinition
        mem.overloading?
      else
        false
      end
    end

update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in) click to toggle source

    # File rbs-3.8.0/lib/rbs/definition.rb, line 63
    def update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in)
      TypeDef.new(type: type, member: member, defined_in: defined_in, implemented_in: implemented_in, overload_annotations: overload_annotations)
    end