Check method existence in `to_enum'; ref
MODIFY
mrbgems/mruby-enum-lazy/mrblib/lazy.rb
mrbgems/mruby-enum-lazy/mrblib/lazy.rb
@@ -43,6 +43,9 @@ class Enumerator
end
def to_enum(meth=:each, *args, &block)
+ unless self.respond_to?(meth)
+ raise NoMethodError, "undefined method #{meth}"
+ end
lz = Lazy.new(self, &block)
lz.obj = self
lz.meth = meth

MODIFY
mrbgems/mruby-enumerator/mrblib/enumerator.rb
mrbgems/mruby-enumerator/mrblib/enumerator.rb
@@ -115,6 +115,9 @@ class Enumerator
else
raise ArgumentError unless obj
end
+ if @obj and !self.respond_to?(meth)
+ raise NoMethodError, "undefined method #{meth}"
+ end
@obj = obj
@meth = meth

Check method existence in `to_enum'; ref #3773