Sha256: cf07b54bc10b6aec9a6c70ac47a395e47c2548306f1b50519e8e756b6dea1806

Contents?: true

Size: 565 Bytes

Versions: 1

Compression:

Stored size: 565 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
raap-0.4.0 lib/raap/value/variable.rb