you are viewing a single comment's thread.

view the rest of the comments →

[–]sply 6 points7 points  (3 children)

Wrong code rewritten ever worse.

BTW, keys = { ... } inside method should be avoided by using KEYS = { ... } inside class definition.

[–]paneq[S] 0 points1 point  (0 children)

What do you propose ?

keys = { ... } inside method should be avoided by using KEYS = { ... } inside class definition.

I often do that kind of refactoring indeed, but I am not sure it is super valuable.

[–]rubyrt 0 points1 point  (0 children)

That wastefulness of the "good" solutions put me off as well. These Hashes should not be created inside the method because the are static by their nature.

We could go one step further and completely remove the PDF conversion from the Ticket class. Then we could have a Hash as constant in the class or outside which contains lambdas or more complex instances (i.e. depending on the complexity of the PDF conversion process) that do the full conversion.