Class: Rico::Resolver
- Inherits:
-
Object
- Object
- Rico::Resolver
- Defined in:
- lib/rico/resolver.rb
Class Method Summary collapse
Class Method Details
.to_proc ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rico/resolver.rb', line 3 def self.to_proc @to_proc ||= lambda do |robject| klasses = robject.siblings.map{|s| s.data && s.data["_type"] }.compact.uniq return nil unless klasses.length == 1 klass_name = Rico::TYPES.invert[klasses.first] return nil unless klass_name klass = Rico.const_get(klass_name) return nil unless klass.respond_to?(:resolve) klass.resolve(robject) end end |