lib/coactive/lookups/name.rb in coactive-0.1.2 vs lib/coactive/lookups/name.rb in coactive-0.2.0

- old
+ new

@@ -13,12 +13,13 @@ def load_files Coactive::Loader.call(@klass.coactive_config.load_paths) end def lookup - @klass.coactive_config.base_class.descendants.select do |coactor| - coactor._coactions.any? { |coaction| coaction == @coactant } - end + @klass.coactive_config.base_class.descendants.each_with_object({}).with_index do |(coactor, hash), i| + coaction = coactor.coactions.detect { |coaction| coaction.name == @coactant } + hash[[coaction.priority || 1 << 63, i]] = coactor if coaction + end.sort.map { |x| x[1] } end class << self def callable?(coactant) coactant.is_a?(Symbol)