Sha256: a8cc52ed26ca764c507de7c93614fab80aed1a4b6bffd06a18ad3f03faf0ee41

Contents?: true

Size: 979 Bytes

Versions: 6

Compression:

Stored size: 979 Bytes

Contents

# encoding: utf-8

require_relative '../y_support'

# Typing library.
#
# A collection of helper methods mainly for argument validation. We often want
# to validate that arguments are of certain class, or that they fulfill some
# other criteria, and raise sufficiently informative error messages when not.
# I've been also experimenting with what I call "typing by declaration", that
# is, when a class declares compliance with another class without actually
# being its descendant, but this idea is still experimental. Basically,
# 'y_support/typing' remains a library of runtime assertions.

directories_to_look_in = [ :typing ]

# The following code looks into the specified directory(ies) and requires
# all the files in it (them).
# 
directories_to_look_in.each do |name|
  Dir["#{File.dirname( __FILE__ )}/#{name}/*/typing.rb"].sort.each do |path|
    dir = File.dirname( path ).match( "y_support/#{name}" ).post_match
    require_relative "#{name}#{dir}/typing"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
y_support-2.5.3 lib/y_support/typing.rb
y_support-2.5.2 lib/y_support/typing.rb
y_support-2.5.1 lib/y_support/typing.rb
y_support-2.4.6 lib/y_support/typing.rb
y_support-2.4.5 lib/y_support/typing.rb
y_support-2.4.4 lib/y_support/typing.rb