This issue was reported on bugs.ruby-lang.org: https://bugs.ruby-lang.org/issues/11465
The issue appears when using Array#flatten on an instance of Array containing instances of a Class that implements method_missing.
Ruby still calls #to_ary even when said class implements respond_to_missing? and returns false for to_ary.
Everything works when the class also overwrites respond_to?.
- Is it expected that
respond_to_missing?has no effect in the scenario above? - Should a possible workaround rather define a
respond_to?method or overwriteto_aryand returnnil?