@@ -660,7 +660,21 @@ bind_local_variable_defined_p(VALUE bindval, VALUE sym)
660660 * call-seq:
661661 * binding.implicit_parameters -> Array
662662 *
663- * TODO
663+ * Returns the names of numbered parameters and "it" parameter
664+ * that are defined in the binding.
665+ *
666+ * def foo
667+ * [42].each do
668+ * it
669+ * binding.local_variables #=> [:it]
670+ * end
671+ *
672+ * { k: 42 }.each do
673+ * _2
674+ * binding.local_variables #=> [:_1, _:2]
675+ * end
676+ * end
677+ *
664678 */
665679static VALUE
666680bind_implicit_parameters (VALUE bindval )
@@ -683,7 +697,21 @@ bind_implicit_parameters(VALUE bindval)
683697 * call-seq:
684698 * binding.implicit_parameter_get(symbol) -> obj
685699 *
686- * TODO
700+ * Returns the value of the numbered parameter or "it" parameter.
701+ *
702+ * def foo
703+ * [42].each do
704+ * it
705+ * binding.local_variable_get(:it) #=> 42
706+ * end
707+ *
708+ * { k: 42 }.each do
709+ * _2
710+ * binding.local_variable_get(:_1) #=> :k
711+ * binding.local_variable_get(:_2) #=> 42
712+ * end
713+ * end
714+ *
687715 */
688716static VALUE
689717bind_implicit_parameter_get (VALUE bindval , VALUE sym )
@@ -716,7 +744,23 @@ bind_implicit_parameter_get(VALUE bindval, VALUE sym)
716744 * call-seq:
717745 * binding.implicit_parameter_defined?(symbol) -> obj
718746 *
719- * TODO
747+ * Returns +true+ if the numbered parameter or "it" parameter exists.
748+ *
749+ * def foo
750+ * [42].each do
751+ * it
752+ * binding.local_variable_defined?(:it) #=> true
753+ * binding.local_variable_defined?(:_1) #=> false
754+ * end
755+ *
756+ * { k: 42 }.each do
757+ * _2
758+ * binding.local_variable_defined?(:_1) #=> true
759+ * binding.local_variable_defined?(:_2) #=> true
760+ * binding.local_variable_defined?(:_3) #=> false
761+ * binding.local_variable_defined?(:it) #=> false
762+ * end
763+ * end
720764 *
721765 */
722766static VALUE
0 commit comments