Re: Template Method Pattern (GoF) without abstract methods in Ruby
Michael Schwarze <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Andy, > Am 11.01.2019 um 10:28 schrieb Andy Jones <[email protected]>: > Obviously Ruby doesn't have abstract classes or abstract methods. But AFAIK the idiomatic way to simulate an abstract method in Ruby is: > > ######### > def foo > fail NotImplementedError, "You need to override this method" > end > ######### > > ...and of course an "abstract class" is any class that has an abstract method in it. That’s exactly what I meant with 'abstract‘ method and what got me confused: As you said and Russ Olson wrote, Ruby doesn’t have them. Should we then really simulate them? The examples I found on the web did it but do they exist in real Ruby code bases / do you use them or are they just examples? Many thanks! Cheers, Michael Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>