Hacker News new | ask | show | jobs
by petercooper 4995 days ago
A few things stand out as distinctive in terms of Ruby style. For example, for self.send "#{sym}=", val, I'd much prefer to see send :"#{sym}=", val. And "sym" is a poor choice of variable name semantically when it's really referring to an attribute name.

If I were writing this, I'd probably have a single hash that defines the SOAP names and internal names then dynamically create those accessors and dynamically create the hash in to_hash rather than have repetition. DRY and all that. So there are other ways to go about it.

There's not a great deal to go on, of course, but the chance of two independent Rubyists stumbling across an identical solution syntax-wise is far from high (though is not minuscule, either.)

1 comments

Valid point. When I first looked at the code I knew the initialize code was fairly common, but then I noticed the unnecessary require. I started to explore a bit more and noticed that the style changes from the copied code[1]. They also place their require statements immediately after module declaration[1]. Not to mention the use of single quotes vs double quotes.

1 - https://github.com/donnen/TaxCloud/blob/b036594969f045660a79...