File: assertions.rb

package info (click to toggle)
libextlib-ruby 0.9.13-2%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 532 kB
  • ctags: 487
  • sloc: ruby: 7,118; makefile: 3
file content (8 lines) | stat: -rw-r--r-- 281 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
module Extlib
  module Assertions
    def assert_kind_of(name, value, *klasses)
      klasses.each { |k| return if value.kind_of?(k) }
      raise ArgumentError, "+#{name}+ should be #{klasses.map { |k| k.name } * ' or '}, but was #{value.class.name}", caller(2)
    end
  end
end