Sha256: 5c2982d5adcf38c9707a37386706aa5880aa1f430d835616ba2fa65147e28344

Contents?: true

Size: 689 Bytes

Versions: 20

Compression:

Stored size: 689 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(*a)
        { string: string, location: location }.to_json(*a)
      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

20 entries across 20 versions & 1 rubygems

Version Path
rbs-1.1.1 lib/rbs/ast/comment.rb
rbs-1.1.0 lib/rbs/ast/comment.rb
rbs-1.0.6 lib/rbs/ast/comment.rb
rbs-1.0.5 lib/rbs/ast/comment.rb
rbs-1.0.4 lib/rbs/ast/comment.rb
rbs-1.0.3 lib/rbs/ast/comment.rb
rbs-1.0.2 lib/rbs/ast/comment.rb
rbs-1.0.1 lib/rbs/ast/comment.rb
rbs-1.0.0 lib/rbs/ast/comment.rb
rbs-1.0.0.pre2 lib/rbs/ast/comment.rb
rbs-1.0.0.pre lib/rbs/ast/comment.rb
rbs-0.20.1 lib/rbs/ast/comment.rb
rbs-0.20.0 lib/rbs/ast/comment.rb
rbs-0.19.0 lib/rbs/ast/comment.rb
rbs-0.18.1 lib/rbs/ast/comment.rb
rbs-0.18.0 lib/rbs/ast/comment.rb
rbs-0.17.0 lib/rbs/ast/comment.rb
rbs-0.16.0 lib/rbs/ast/comment.rb
rbs-0.15.0 lib/rbs/ast/comment.rb
rbs-0.14.0 lib/rbs/ast/comment.rb