class RBS::Definition::Method::TypeDef
Attributes
Public Class Methods
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 40 def initialize(type:, member:, defined_in:, implemented_in:, overload_annotations: []) @type = type @member = member @defined_in = defined_in @implemented_in = implemented_in @member_annotations = [] @overload_annotations = [] @annotations = [] end
Public Instance Methods
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 50 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?
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 64 def comment member.comment end
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 84 def each_annotation(&block) if block member_annotations.each(&block) overload_annotations.each(&block) else enum_for :each_annotation end end
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 60 def hash self.class.hash ^ type.hash ^ member.hash ^ defined_in.hash ^ implemented_in.hash end
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 75 def overload? case mem = member when AST::Members::MethodDefinition mem.overloading? else false end end
Source
# File bundled-src/rbs-3.10.0/lib/rbs/definition.rb, line 68 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).tap do |type_def| type_def.overload_annotations.replace(self.overload_annotations) type_def.member_annotations.replace(self.member_annotations) end end