Sha256: 706761c3c61fa28910db49fbf470a0b943e6614f2f43cd32d37efb5fc8adf4ce

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module RaaP
  module Value
    class Variable < BasicObject
      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

2 entries across 2 versions & 1 rubygems

Version Path
raap-0.6.0 lib/raap/value/variable.rb
raap-0.5.0 lib/raap/value/variable.rb