lib/surrounded/context/name_collision_detector.rb in surrounded-0.9.10 vs lib/surrounded/context/name_collision_detector.rb in surrounded-0.9.11

- old
+ new

@@ -5,13 +5,11 @@ attr_reader :handler def self.extended(base) base.send :include, NameCollisionHandler - unless defined?(base::NameCollisionError) - base.const_set(:NameCollinionError, Class.new(::Surrounded::Context::NameCollisionError)) - end + Surrounded::Exceptions.define(base, exceptions: :NameCollisionError) end def on_name_collision(method_name) @handler = method_name end @@ -59,10 +57,10 @@ elsif respond_to?(handler, true) method(handler) elsif self.class.respond_to?(handler, true) self.class.method(handler) else - method(:nothing) + raise ArgumentError, %{your name collision handler was set to `#{handler}' but there is no instance nor class method of that name} end end end end end \ No newline at end of file