# Module\_eval question

**URL:** <https://www.ruby-forum.com/t/module-eval-question/145488>\
**Category:** Ruby\
**Created:** [August 10, 2008, 6:01pm UTC](https://www.ruby-forum.com/t/module-eval-question/145488 "2008-08-10T18:01:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 10, 2008, 6:01pm UTC](https://www.ruby-forum.com/t/module-eval-question/145488/1 "2008-08-10T18:01:52Z")

</div>

hey guys, im looking at the C API function rb\_mod\_module\_eval() and i  
dont  
entirely understand the parameters being passed to it. can someone  
please  
explain how to use the rb\_mod\_module\_eval() function ? (note im asking  
about the  
C API function not the ruby module\_eval function, thanks :D)

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 10, 2008, 6:44pm UTC](https://www.ruby-forum.com/t/module-eval-question/145488/2 "2008-08-10T18:44:28Z")

</div>

John M. wrote:

> hey guys, im looking at the C API function rb\_mod\_module\_eval() and i  
> dont  
> entirely understand the parameters being passed to it. can someone  
> please  
> explain how to use the rb\_mod\_module\_eval() function ? (note im asking  
> about the  
> C API function not the ruby module\_eval function, thanks :D)

Looks like it corresponds fairly closely to Module#module\_eval.

If there is a code block available to be yielded to, it takes no  
arguments and yields to the block. Otherwise, it takes at least 1  
argument, a string to be eval’d. You can also supply a 2nd argument or a  
3rd argument, which are used as the file name and line number,  
respectively, in any error messages.
