Class: YaKassa::V3::Utilites::String

Inherits:
Object
  • Object
show all
Defined in:
lib/ya_kassa/v3/utilites/string.rb

Class Method Summary collapse

Class Method Details

.constantize(camel_cased_word) ⇒ Object

copied from activesupport/lib/active_support/inflector



6
7
8
9
10
11
# File 'lib/ya_kassa/v3/utilites/string.rb', line 6

def self.constantize(camel_cased_word)
  unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
    raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
  end
  Object.module_eval("::#{$1}", __FILE__, __LINE__)
end