Module: Jackal::Utils::Constants

Included in:
Callback, Jackal::Utils
Defined in:
lib/jackal/utils/constants.rb

Instance Method Summary collapse

Instance Method Details

#constantize(string) ⇒ Class

Provide constant defined by string

Parameters:

  • string (String)

    constant to locate

Returns:

  • (Class)


11
12
13
14
15
# File 'lib/jackal/utils/constants.rb', line 11

def constantize(string)
  klass = string.to_s.split('::').inject(Object) do |memo, name|
    memo.const_get(name)
  end
end