Module: ToeTag::Util

Defined in:
lib/toe_tag.rb

Class Method Summary collapse

Class Method Details

.try_constantize(name) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/toe_tag.rb', line 6

def self.try_constantize(name)
  if RUBY_VERSION >= "2.0.0"
    Object.const_get name
  else
    eval name
  end
rescue NameError
  # const doesn't exist, just return nil
end