Script_lines__

If the constant SCRIPT_LINES__ is defined and holds a hash, for each
file
loaded after the constant definition the hash gets an entry that maps
the
file name to an array of strings: the file lines.

Does anybody have a use case for this constant, or know the rationale
behind this feature?

Hi,

You can use this for debugging. If you extract the file name and line
number from the stracktrace of an error, you can print out the actual
line from SCRIPT_LINES__.

Unsubscribe Tombari Biranen
Sent from my BlackBerry wireless device from MTN

Xavier N. wrote in post #1052200:

Is that an idea or do you mean Ruby debuggers do use that constant?

I don’t know which programs actually use the constant. But does it even
matter? You can use it for whatever you want. :wink:

Anyway, this usecase is described in the Ruby book by Flanagan and
Matsumoto.

On Sun, Mar 18, 2012 at 10:13 PM, Jan E. [email protected] wrote:

You can use this for debugging. If you extract the file name and line

number from the stracktrace of an error, you can print out the actual
line from SCRIPT_LINES__.

Is that an idea or do you mean Ruby debuggers do use that constant?

Yes, they do use it. Also test coverage programs appear to use it.

On Sun, Mar 18, 2012 at 10:57 PM, Jan E. [email protected] wrote:

Hi Jan, thanks for your reply.

Xavier N. wrote in post #1052200:

Is that an idea or do you mean Ruby debuggers do use that constant?

I don’t know which programs actually use the constant. But does it even
matter?

I wonder about real use cases.