Module: Shoryuken::StringExt::Constantize
- Included in:
- String
- Defined in:
- lib/shoryuken/core_ext.rb
Instance Method Summary collapse
Instance Method Details
#constantize ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/shoryuken/core_ext.rb', line 36 def constantize names = 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 |