class RBS::AST::Members::MethodDefinition

Attributes

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

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 26
def ==(other)
  other.is_a?(MethodDefinition) &&
    other.name == name &&
    other.kind == kind &&
    other.types == types &&
    other.overload == overload
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 36
def hash
  self.class.hash ^ name.hash ^ kind.hash ^ types.hash ^ overload.hash
end
instance?() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 40
def instance?
  kind == :instance || kind == :singleton_instance
end
overload?() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 48
def overload?
  overload
end
singleton?() click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 44
def singleton?
  kind == :singleton || kind == :singleton_instance
end
to_json(state = _ = nil) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 64
def to_json(state = _ = nil)
  {
    member: :method_definition,
    kind: kind,
    types: types,
    annotations: annotations,
    location: location,
    comment: comment,
    overload: overload
  }.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) click to toggle source
# File rbs-1.4.0/lib/rbs/ast/members.rb, line 52
def update(name: self.name, kind: self.kind, types: self.types, annotations: self.annotations, location: self.location, comment: self.comment, overload: self.overload)
  self.class.new(
    name: name,
    kind: kind,
    types: types,
    annotations: annotations,
    location: location,
    comment: comment,
    overload: overload
  )
end