3 ms·
Ruby Hash Selector Pattern
- james2vegas 13y agoA lookup table is a pattern now? http://search.cpan.org/~gsar/perl5.005/pod/perlfaq7.pod#How_do_I_create_a_switch_or_case_statement%3f http://search.cpan.org/~gsar/perl5.005/pod/perlfaq7.pod#How_...
- emackn 13y agoAt 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 ;)
- twinn 13y agoTotally agree with not using this with procs/lambdas, but his first example seemed like a nice use case.