class RBS::AST::Members::MethodDefinition
Attributes
annotations
[R]
Array[Annotation]
comment
[R]
Comment?
kind
[R]
kind
location
[R]
loc?
overloading
[R]
bool
overloads
[R]
Array[Overload]
visibility
[R]
visibility?
Public Class Methods
(name: Symbol, kind: kind, overloads: Array[Overload], annotations: Array[Annotation], location: loc?, comment: Comment?, overloading: bool, visibility: visibility?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 55 def initialize(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) @name = name @kind = kind @overloads = overloads @annotations = annotations @location = location @comment = comment @overloading = overloading @visibility = visibility end
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 66 def ==(other) other.is_a?(MethodDefinition) && other.name == name && other.kind == kind && other.overloads == overloads && other.overloading? == overloading? && other.visibility == visibility end
Also aliased as: eql?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 77 def hash name.hash ^ kind.hash ^ overloads.hash ^ overloading?.hash ^ visibility.hash end
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 81 def instance? kind == :instance || kind == :singleton_instance end
Returns true if the def is to define instance method
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 89 def overloading? overloading end
Returns true if the def is overloading (== with ...)
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 85 def singleton? kind == :singleton || kind == :singleton_instance end
Returns true if the def is to define singleton method
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 106 def to_json(state = nil) { member: :method_definition, name: name, kind: kind, overloads: overloads, annotations: annotations, location: location, comment: comment, overloading: overloading?, visibility: visibility }.to_json(state) end
(?name: Symbol, ?kind: kind, ?overloads: Array[Overload], ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?, ?overloading: bool, ?visibility: visibility?) → MethodDefinition
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/ast/members.rb, line 93 def update(name: self.name, kind: self.kind, overloads: self.overloads, annotations: self.annotations, location: self.location, comment: self.comment, overloading: self.overloading?, visibility: self.visibility) self.class.new( name: name, kind: kind, overloads: overloads, annotations: annotations, location: location, comment: comment, overloading: overloading, visibility: visibility ) end