Ruby Hash Selector Pattern(codemy.net)
codemy.net
Ruby Hash Selector Pattern
https://www.codemy.net/posts/hash-selector-pattern
2 comments
A lookup table is a pattern now?
http://search.cpan.org/~gsar/perl5.005/pod/perlfaq7.pod#How_...
At first glance, I was like "cool", let me check this out. Thinking about it a bit, I was wondering if this would ever pass a code review from my peers.
Probably not.
A Hash with values that are procs/lambdas? Seems like you are halfway to recognizing that you need an object.
But if you are having fun coding, that's all that matters, until you do a pull request with that in it ;)
Probably not.
A Hash with values that are procs/lambdas? Seems like you are halfway to recognizing that you need an object.
But if you are having fun coding, that's all that matters, until you do a pull request with that in it ;)
Totally agree with not using this with procs/lambdas, but his first example seemed like a nice use case.