[LRUG] attr_accessor parsed as a method variable when setting with a get

James Darling james at abscond.org
Wed Sep 21 02:50:21 PDT 2011


I spent quite a while trying to isolate an issue yesterday. I've done so
now, and worked around it, but now I'm interested in what's going on.

I'm not very good at explaining code, the email title is my best attempt, so
I'll just post an example:

https://gist.github.com/1231642

It seems that on line 9, the second use of the configuration getter method
call is being parsed as a method variable, which is nil as it isn't set. You
can work around this by explicitly saying this.configuration or
configuration(), but it certainly doesn't behave as you would expect.

This happens in ruby 1.9.2 and 1.8.7.

Anyone come across this before? Any ideas why it happens? Is it fixable, or
just an unfortunate byproduct of how ruby parses?

James Darling

@abscond | 07811407085 | http://abscond.org

Brusque? I loosely follow http://five.sentenc.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20110921/8368070a/attachment-0003.html>


More information about the Chat mailing list