Class: Object

Inherits:
BasicObject
Defined in:
lib/basic/basic.rb

Instance Method Summary collapse

Instance Method Details

#assert_type(clas, msg = nil) ⇒ Object


40
41
42
43
44
45
46
47
# File 'lib/basic/basic.rb', line 40

def assert_type clas, msg = nil
  msg ||= "Bad type: expected #{clas}, got #{self.class}"
  if !clas.kind_of? Array then clas = [clas] end
  clas.each { |c|
    if self.kind_of?( c ) then return; end
  }
  assert false, "Bad type: expected #{clas}, got #{self.class}"
end

#stringable?Boolean


49
50
51
# File 'lib/basic/basic.rb', line 49

def stringable?
  respond_to? 'to_s'
end