Semicolon in object variable name
- by milkfilk
There's a common LDAP attribute called userCertificate;binary.  It actually has a semi-colon in the attribute name.  In ruby, I turn an LDAP entry into a OpenStruct object called 'struct'.
 struct.class
= OpenStruct
But of course ruby thinks it's an end-of-line character.
? struct.userCertificate;binary
NameError: undefined local variable or method `binary' for main:Object
        from (irb):52
        from :0
IRB knows that the local variable is there, because it gives me struct.userCertificate;binary from the tab auto-completion.  I can also see the class variable when calling struct.methods on it.
 struct.methods
= ... "send", "methods", "userCertificate;binary=", "hash", ...
It's definitely there, I can see the contents if I print the whole variable to_s().  But how can I access the local variable when it has a semicolon in it?  I have workarounds for this but I thought it was an interesting problem to post.