Sha256: d88fe9517a8bed9132310b74dd4f2d68985c83894d595153792e06a00b16d5ea

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 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
        @location.concat location
        self
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbs-0.11.0 lib/rbs/ast/comment.rb
rbs-0.10.0 lib/rbs/ast/comment.rb
rbs-0.9.1 lib/rbs/ast/comment.rb
rbs-0.9.0 lib/rbs/ast/comment.rb