Module: Clarion::ConstFinder
- Defined in:
- lib/clarion/const_finder.rb
Class Method Summary collapse
Class Method Details
.find(const, prefix, name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/clarion/const_finder.rb', line 3 def self.find(const, prefix, name) retried = false constant_name = name.to_s.gsub(/\A.|_./) { |s| s[-1].upcase } begin const.const_get constant_name, false rescue NameError unless retried begin require "#{prefix}/#{name}" rescue LoadError end retried = true retry end nil end end |