Module: Pantheios::Util::ReflectionUtil

Defined in:
lib/pantheios/util/reflection_util.rb

Overview

reflection utilities

Defined Under Namespace

Modules: ReflectionUtil_Constants

Class Method Summary collapse

Class Method Details

.non_root_classes(o) ⇒ Object

Obtains a list of all classes pertaining to o, excepting root objects (::Object and ::BaseObject).



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pantheios/util/reflection_util.rb', line 15

def self.non_root_classes o

	return [] if o.nil?

	return self.non_root_classes o.class unless ::Class === o

	return [] if ReflectionUtil_Constants::ROOT_CLASSES.any? { |c| c == o }

	s = o.superclass

	return [ o ] if ::Object == s

	[ o ] + self.non_root_classes(s)
end