123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Members::MethodDefinition

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: RBS::AST::Members::Base
Defined in: lib/rbs/ast/members.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, kind:, overloads:, annotations:, location:, comment:, overloading:, visibility:) ⇒ MethodDefinition

[ GitHub ]

  
# File '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

Instance Attribute Details

#annotations (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 47

attr_reader :annotations

#comment (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 49

attr_reader :comment

#instance?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 79

def instance?
  kind == :instance || kind == :singleton_instance
end

#kind (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 45

attr_reader :kind

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 48

attr_reader :location

#name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 44

attr_reader :name

#overloading (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 50

attr_reader :overloading

#overloading?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 87

def overloading?
  overloading
end

#overloads (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 46

attr_reader :overloads

#singleton?Boolean (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 83

def singleton?
  kind == :singleton || kind == :singleton_instance
end

#visibility (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 51

attr_reader :visibility

Instance Method Details

#==(other) Also known as: #eql?

[ GitHub ]

  
# File '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

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 73

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/members.rb', line 75

def hash
  name.hash ^ kind.hash ^ overloads.hash ^ overloading?.hash ^ visibility.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File '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)

[ GitHub ]

  
# File '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