class Object

Subversion information $Id: utils.rb 337 2011-10-14 16:11:39Z nelsonab $ $Revision: 337 $

Public Class Methods

class_of?(obj) click to toggle source

self.class_of? Ruby's is_a? or kind_of? will only tell you the hierarchy of classes which have been instantiated.

# File zbxapi/utils.rb, line 29
def self.class_of?(obj)
  raise RuntimeError.new("Obj must be an uninstantiated class, often calling method \".class\" works") if obj.class!=Class
  return true if self==obj
  if self.superclass.respond_to?(:class_of?)
    self.superclass.class_of?(obj)
  else
    false
  end
end

Public Instance Methods

silence_warnings() { || ... } click to toggle source
# File zbxapi.rb, line 52
def silence_warnings
  old_verbose, $VERBOSE = $VERBOSE, nil
  yield
ensure
  $VERBOSE = old_verbose
end