Sha256: ec70ab52ff66e3713f8dc1c21d671512883c4013384a12489d2211ec9b50b0b0

Contents?: true

Size: 530 Bytes

Versions: 52

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

module RBS
  module AST
    class Comment
      attr_reader :string
      attr_reader :location

      def initialize(string:, location:)
        @string = string
        @location = location
      end

      def ==(other)
        other.is_a?(Comment) && other.string == string
      end

      alias eql? ==

      def hash
        self.class.hash ^ string.hash
      end

      def to_json(state = _ = nil)
        { string: string, location: location }.to_json(state)
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rbs-3.0.0.dev.2 lib/rbs/ast/comment.rb
rbs-2.8.4 lib/rbs/ast/comment.rb
rbs-2.8.3 lib/rbs/ast/comment.rb
rbs-3.0.0.dev.1 lib/rbs/ast/comment.rb
rbs-2.8.2 lib/rbs/ast/comment.rb
rbs-2.8.1 lib/rbs/ast/comment.rb
rbs-2.8.0 lib/rbs/ast/comment.rb
rbs-2.8.0.pre.1 lib/rbs/ast/comment.rb
rbs-2.7.0 lib/rbs/ast/comment.rb
rbs-2.7.0.pre.3 lib/rbs/ast/comment.rb
rbs-2.7.0.pre.2 lib/rbs/ast/comment.rb
rbs-2.7.0.pre.1 lib/rbs/ast/comment.rb