false instance and false class and set_trace_func

T

trans. (T. Onoma)

When I use set_trace_func the class argument that is passed in is often just
'false', which I just took to be the FalseClass, having always thought they
were synonymous. I see now that is not so:

false.class
=> FalseClass
irb(main):002:0> false.class.name
=> "FalseClass"
irb(main):003:0> false.name
NoMethodError: undefined method `name' for false:FalseClass
from (irb):3

So then why is set_trace_func turning up with false in the class parameter?

Thanks,
T.
 
D

David A. Black

Hi --

When I use set_trace_func the class argument that is passed in is often just
'false', which I just took to be the FalseClass, having always thought they
were synonymous. I see now that is not so:

false is an instance of FalseClass.
false.class
=> FalseClass
irb(main):002:0> false.class.name
=> "FalseClass"
irb(main):003:0> false.name
NoMethodError: undefined method `name' for false:FalseClass
from (irb):3

So then why is set_trace_func turning up with false in the class parameter?

I think it does that for 'line' events.


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top