Sha256: 6257de1f33f244910d68211022b3c64e1cf1a82231227935831a13231c5ba997

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

module RaaP
  module Value
    class Variable
      attr_reader :type

      def initialize(type)
        @type =
          if type.respond_to?(:to_sym)
            # @type var type: String | Symbol
            ::RBS::Types::Variable.new(name: type.to_sym, location: nil)
          else
            type
          end
        unless @type.instance_of?(::RBS::Types::Variable)
          ::Kernel.raise ::TypeError, "not a variable type: #{@type}"
        end
      end

      def inspect = "#<var #{type}>"
      def class = Variable
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
raap-1.0.0 lib/raap/value/variable.rb
raap-0.10.0 lib/raap/value/variable.rb
raap-0.9.0 lib/raap/value/variable.rb
raap-0.8.0 lib/raap/value/variable.rb