Sha256: 4df05e5bcc6bc3106e47cf590bb88878716d8edf094ff92057a92f0d011c3f68

Contents?: true

Size: 610 Bytes

Versions: 4

Compression:

Stored size: 610 Bytes

Contents

module Yoda
  module Typing
    module Types
      class Generic < Base
        # @return [Base]
        attr_reader :base

        # @return [Array<Base>]
        attr_reader :type_args

        # @param base [Base]
        # @param type_args [Array<Base>]
        def initialize(base:, type_args:)
          @base = base
          @type_args = type_args
        end

        def to_expression
          base.to_expression
        end

        def to_type_string
          inner = type_args.map(&:to_type_string)
          "#{base.to_type_string}<#{inner.join(', ')}>"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/typing/types/generic.rb
yoda-language-server-0.10.0 lib/yoda/typing/types/generic.rb
yoda-language-server-0.9.0 lib/yoda/typing/types/generic.rb
yoda-language-server-0.8.0 lib/yoda/typing/types/generic.rb