123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, MixinHelper, Base
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:, members:, annotations:, location:, comment:) ⇒ Interface

[ GitHub ]

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

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

Instance Attribute Details

#annotations (readonly)

[ GitHub ]

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

attr_reader :annotations

#comment (readonly)

[ GitHub ]

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

attr_reader :comment

#location (readonly)

[ GitHub ]

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

attr_reader :location

#members (readonly)

[ GitHub ]

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

attr_reader :members

#name (readonly)

[ GitHub ]

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

attr_reader :name

#type_params (readonly)

[ GitHub ]

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

attr_reader :type_params

Instance Method Details

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

[ GitHub ]

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

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

#eql?(other)

Alias for #==.

[ GitHub ]

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

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

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

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