#encoding: utf-8 require 'y_support' # Typing library. # # Apart from usual typing by class and ancestry, supported by built-in # #kind_of?, alias #is_a? inquirerers, this typing library provides support for # provides support for typing by declaration and duck typing. # # 1. Using method declare_compliance, a module can explicitly declare that # it provides the interface compliant with another module. Corresponding inquirer # methods are declared_compliance (returning a list of modules with which # the receiver declares compliance or implicitly complies) and # declares_compliance?( other_module ), which anwers whether the receiver # complies with other_module. An object always implicitly complies with its class # and class ancestry. # # 2. Duck type enforcement for method parameters is supported by a collection of # enforcer methods (aka. run-time assertions). These methods look very much like # assertions, but they start with tE_..., meaning "enforce by raising # TypeError". [ :core_ext, :stdlib_ext ].each do |ext| Dir["#{File.dirname( __FILE__ )}/#{ext}/*/misc.rb"].sort.each { |path| dir = File.dirname( path ).match( "y_support/#{ext}" ).post_match require "y_support/#{ext}#{dir}/misc" } end