Typespec

Typespec is a Ruby gem that provides a notation for declaring types and specifications that can be validated against. It was originally created for Pour (itself created for Ryb). Hopefully you can find another use for it.

module Defines
  def self.typespec
    Typespec.hash[Typespec.string => Typespec.or[Typespec.nothing,
                                                 Typespec.boolean,
                                                 Typespec.number,
                                                 Typespec.string]]
  end
end

Defines.typespec.valid?('YETI_LINKAGE' => 'YETI_LINKAGE_STATIC',
                        '__YETI_IS_BEING_COMPILED__' => true,
                        'YETI_CONFIGURATION' => 'YETI_CONFIGURATION_DEBUG',
                        '_HAS_EXCEPTIONS' => false,
                        '_SCL_SECURE_NO_WARNINGS' => true,
                        '_CRT_SECURE_NO_WARNINGS' => true,
                        '_CRT_SECURE_NO_DEPRECATE' => true,
                        '_SECURE_SCL_THROWS' => false,
                        '_SILENCE_DEPRECATION_OF_SECURE_SCL_THROWS' => true,
                        '_USING_V110_SDK71_' => true,
                        '_DEBUG' => true,
                        '_HAS_ITERATOR_DEBUGGING' => true,
                        '_SECURE_SCL' => true)

#=> true

A monstrosity made by Michael Williams.