Guest User

Untitled

a guest
Apr 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. 355 def constantize(camel_cased_word)
  2. 356 names = camel_cased_word.split('::')
  3. 357 names.shift if names.empty? || names.first.empty?
  4. 358
  5. 359 constant = Object
  6. 360 names.each do |name|
  7. 361 constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  8. 362 end
  9. 363 constant
  10. 364 en
Add Comment
Please, Sign In to add comment