123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Declarations::Class

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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, type_params:, super_class:, members:, annotations:, location:, comment:) ⇒ Class

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 97

def initialize(name:, type_params:, super_class:, members:, annotations:, location:, comment:)
  @name = name
  @type_params = type_params
  @super_class = super_class
  @members = members
  @annotations = annotations
  @location = location
  @comment = comment
end

Instance Attribute Details

#annotations (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 93

attr_reader :annotations

#comment (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 95

attr_reader :comment

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 94

attr_reader :location

#members (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 91

attr_reader :members

#name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 89

attr_reader :name

#super_class (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 92

attr_reader :super_class

#type_params (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 90

attr_reader :type_params

Instance Method Details

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

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 119

def ==(other)
  other.is_a?(Class) &&
    other.name == name &&
    other.type_params == type_params &&
    other.super_class == super_class &&
    other.members == members
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 127

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 129

def hash
  self.class.hash ^ name.hash ^ type_params.hash ^ super_class.hash ^ members.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 133

def to_json(state = _ = nil)
  {
    declaration: :class,
    name: name,
    type_params: type_params,
    members: members,
    super_class: super_class,
    annotations: annotations,
    location: location,
    comment: comment
  }.to_json(state)
end

#update(name: self.name, type_params: self.type_params, super_class: self.super_class, members: self.members, annotations: self.annotations, location: self.location, comment: self.comment)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 107

def update(name: self.name, type_params: self.type_params, super_class: self.super_class, members: self.members, annotations: self.annotations, location: self.location, comment: self.comment)
  self.class.new(
    name: name,
    type_params: type_params,
    super_class: super_class,
    members: members,
    annotations: annotations,
    location: location,
    comment: comment
  )
end