Sha256: 29c6f185231fbb1f06ebc76469300f1209693be1f8fa78cc4c60c83c8e9ee540

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module Rico
  class Resolver
    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.siblings)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rico-0.1.0 lib/rico/resolver.rb