Module: Pantheios::Util::ReflectionUtil

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

Defined Under Namespace

Modules: ReflectionUtil_Constants

Class Method Summary collapse

Class Method Details

.non_root_classes(o) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pantheios/util/reflection_util.rb', line 12

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