class RBS::AST::Members::MethodDefinition

Attributes

annotations[R]
comment[R]
kind[R]
location[R]
name[R]
overloading[R]
overloads[R]
visibility[R]

Public Class Methods

new(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 53
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

==(other) click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 64
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?
eql?(other)
Alias for: ==
hash() click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 75
def hash
  name.hash ^ kind.hash ^ overloads.hash ^ overloading?.hash ^ visibility.hash
end
instance?() click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 79
def instance?
  kind == :instance || kind == :singleton_instance
end
overloading?() click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 87
def overloading?
  overloading
end
singleton?() click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 83
def singleton?
  kind == :singleton || kind == :singleton_instance
end
to_json(state = _ = nil) click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 104
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
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) click to toggle source
# File rbs-3.1.0/lib/rbs/ast/members.rb, line 91
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