Method: Object#full_const_get

Defined in:
lib/extlib/object.rb

#full_const_get(name) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/extlib/object.rb', line 67

def full_const_get(name)
  list = name.split("::")
  list.shift if list.first.blank?
  obj = self
  list.each do |x|
    # This is required because const_get tries to look for constants in the
    # ancestor chain, but we only want constants that are HERE
    obj = obj.const_defined?(x) ? obj.const_get(x) : obj.const_missing(x)
  end
  obj
end