Module: AePageObjects::Inflector

Extended by:
Inflector
Included in:
Inflector
Defined in:
lib/ae_page_objects/util/inflector.rb

Instance Method Summary collapse

Instance Method Details

#constantize(camel_cased_word) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
33
34
# File 'lib/ae_page_objects/util/inflector.rb', line 25

def constantize(camel_cased_word)
  names = camel_cased_word.split('::')
  names.shift if names.empty? || names.first.empty?

  constant = Object
  names.each do |name|
    constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  end
  constant
end