Sha256: 25f536e43d6589b3cfb8bd1e4e4f2b0233f9a79499f284a0981836a705cfd9a8

Contents?: true

Size: 705 Bytes

Versions: 12

Compression:

Stored size: 705 Bytes

Contents

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

      def concat(string:, location:)
        @string.concat string

        if loc = @location
          loc.concat location
        else
          @location = location
        end

        self
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rbs-1.6.2 lib/rbs/ast/comment.rb
rbs-1.6.1 lib/rbs/ast/comment.rb
rbs-1.6.0 lib/rbs/ast/comment.rb
rbs-1.5.1 lib/rbs/ast/comment.rb
rbs-1.5.0 lib/rbs/ast/comment.rb
rbs-1.4.0 lib/rbs/ast/comment.rb
rbs-1.3.3 lib/rbs/ast/comment.rb
rbs-1.3.2 lib/rbs/ast/comment.rb
rbs-1.3.1 lib/rbs/ast/comment.rb
rbs-1.3.0 lib/rbs/ast/comment.rb
rbs-1.2.1 lib/rbs/ast/comment.rb
rbs-1.2.0 lib/rbs/ast/comment.rb