Sha256: ad66330333a412aead9192449c95a1dd2a0daebdbddeb3d0c1ca9aad52516278

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

module Ruby
  module Signature
    module AST
      class Annotation
        attr_reader :string
        attr_reader :location

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

        def ==(other)
          other.is_a?(Annotation) && 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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
steep-0.14.0 vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb
steep-0.13.0 vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb
steep-0.12.0 vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb