class RBS::AST::Members::MethodDefinition

Attributes

annotations[R]
comment[R]
kind[R]
location[R]
name[R]
overload[R]
types[R]
visibility[R]

Public Class Methods

new(name:, kind:, types:, annotations:, location:, comment:, overload:, visibility: nil) click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 19
def initialize(name:, kind:, types:, annotations:, location:, comment:, overload:, visibility: nil)
  @name = name
  @kind = kind
  @types = types
  @annotations = annotations
  @location = location
  @comment = comment
  @overload = overload ? true : false
  @visibility = visibility
end

Public Instance Methods

==(other) click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 30
def ==(other)
  other.is_a?(MethodDefinition) &&
    other.name == name &&
    other.kind == kind &&
    other.types == types &&
    other.overload == overload &&
    other.visibility == visibility
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 41
def hash
  name.hash ^ kind.hash ^ types.hash ^ overload.hash
end
instance?() click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 45
def instance?
  kind == :instance || kind == :singleton_instance
end
overload?() click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 53
def overload?
  overload
end
singleton?() click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 49
def singleton?
  kind == :singleton || kind == :singleton_instance
end
to_json(state = _ = nil) click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 70
def to_json(state = _ = nil)
  {
    member: :method_definition,
    name: name,
    kind: kind,
    types: types,
    annotations: annotations,
    location: location,
    comment: comment,
    overload: overload,
    visibility: visibility
  }.to_json(state)
end
update(name: self.name, kind: self.kind, types: self.types, annotations: self.annotations, location: self.location, comment: self.comment, overload: self.overload, visibility: self.visibility) click to toggle source
# File rbs-2.8.2/lib/rbs/ast/members.rb, line 57
def update(name: self.name, kind: self.kind, types: self.types, annotations: self.annotations, location: self.location, comment: self.comment, overload: self.overload, visibility: self.visibility)
  self.class.new(
    name: name,
    kind: kind,
    types: types,
    annotations: annotations,
    location: location,
    comment: comment,
    overload: overload,
    visibility: visibility
  )
end