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 30

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 27

attr_reader :defined_in

#implemented_in (readonly)

[ GitHub ]

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

attr_reader :implemented_in

#member (readonly)

[ GitHub ]

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

attr_reader :member

#overload?Boolean (readonly)

[ GitHub ]

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

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

#type (readonly)

[ GitHub ]

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

attr_reader :type

Instance Method Details

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

[ GitHub ]

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

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 55

def annotations
  member.annotations
end

#comment

[ GitHub ]

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

def comment
  member.comment
end

#eql?(other)

Alias for #==.

[ GitHub ]

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

alias eql? ==

#hash

[ GitHub ]

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

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 59

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