lib/surrogate/hatchling.rb in surrogate-0.6.1 vs lib/surrogate/hatchling.rb in surrogate-0.6.2

- old
+ new

@@ -52,11 +52,16 @@ end end def must_know(method_name) return if api_methods.has_key? method_name - known_methods = api_methods.keys.map(&:to_s).map(&:inspect).join ', ' - raise UnknownMethod, "doesn't know \"#{method_name}\", only knows #{known_methods}" + if api_methods.empty? + message = "doesn't know \"#{method_name}\", doesn't know anything! It's an epistemological conundrum, go define #{method_name}." + else + known_methods = api_methods.keys.map(&:to_s).map(&:inspect).join ', ' + message = "doesn't know \"#{method_name}\", only knows #{known_methods}" + end + raise UnknownMethod, message end # maybe these ivar methods should be extracted into their own class def has_ivar?(method_name) instance.instance_variable_defined? ivar_for method_name