Module: Prototok::Utils::Listed
- Included in:
- Ciphers, Encoders, Formatters, Serializers
- Defined in:
- lib/prototok/utils/listed.rb
Instance Method Summary collapse
Instance Method Details
#find(*attrs) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/prototok/utils/listed.rb', line 4 def find(*attrs) @cache ||= {} @cache[attrs] ||= begin const_name = attrs.map do |word| word.to_s.split(/(?=[[:upper:]])|\_/).map(&:capitalize).join end.join('::') begin const_get const_name, false rescue NameError nil end end end |