123456789_123456789_123456789_123456789_123456789_

Class: RBS::Definition::Method::TypeDef

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/definition.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(type:, member:, defined_in:, implemented_in:) ⇒ TypeDef

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 32

def initialize(type:, member:, defined_in:, implemented_in:)
  @type = type
  @member = member
  @defined_in = defined_in
  @implemented_in = implemented_in
end

Instance Attribute Details

#defined_in (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 29

attr_reader :defined_in

#implemented_in (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 30

attr_reader :implemented_in

#member (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 28

attr_reader :member

#overload?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 65

def overload?
  case mem = member
  when AST::Members::MethodDefinition
    mem.overloading?
  else
    false
  end
end

#type (readonly)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 27

attr_reader :type

Instance Method Details

#==(other) Also known as: #eql?

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 39

def ==(other)
  other.is_a?(TypeDef) &&
    other.type == type &&
    other.member == member &&
    other.defined_in == defined_in &&
    other.implemented_in == implemented_in
end

#annotations

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 57

def annotations
  member.annotations
end

#comment

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 53

def comment
  member.comment
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 47

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 49

def hash
  self.class.hash ^ type.hash ^ member.hash ^ defined_in.hash ^ implemented_in.hash
end

#update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in)

[ GitHub ]

  
# File 'lib/rbs/definition.rb', line 61

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)
end