Method: Object#full_const_get

Defined in:
lib/garcon/core_ext/object.rb

#full_const_get(name) ⇒ Object

Returns The constant corresponding to the name.

Parameters:

  • name (String)

    The name of the constant to get, e.g. “Garcon::Check”.

Returns:

  • (Object)

    The constant corresponding to the name.



208
209
210
211
212
213
214
215
216
# File 'lib/garcon/core_ext/object.rb', line 208

def full_const_get(name)
  list = name.split('::')
  list.shift if list.first.blank?
  obj = self
  list.each do |x|
    obj = obj.const_defined?(x) ? obj.const_get(x) : obj.const_missing(x)
  end
  obj
end