class RBS::AST::Declarations::Constant - rbs: Ruby Standard Library Documentation

# class RBS::AST::Declarations::Constant

### Attributes

comment[R]
location[R]
name[R]
type[R]

### Public Class Methods

new(name:, type:, location:, comment:) click to toggle source

    # File rbs-3.8.0/lib/rbs/ast/declarations.rb, line 353
    def initialize(name:, type:, location:, comment:)
      @name = name
      @type = type
      @location = location
      @comment = comment
    end

### Public Instance Methods

==(other) click to toggle source

    # File rbs-3.8.0/lib/rbs/ast/declarations.rb, line 360
    def ==(other)
      other.is_a?(Constant) &&
        other.name == name &&
        other.type == type
    end

Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source

    # File rbs-3.8.0/lib/rbs/ast/declarations.rb, line 368
    def hash
      self.class.hash ^ name.hash ^ type.hash
    end

to_json(state = _ = nil) click to toggle source

    # File rbs-3.8.0/lib/rbs/ast/declarations.rb, line 372
    def to_json(state = _ = nil)
      {
        declaration: :constant,
        name: name,
        type: type,
        location: location,
        comment: comment
      }.to_json(state)
    end