Re: Template Method Pattern (GoF) without abstract methods in Ruby

Dan Itsara <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CAJx8Nujs9G+J4kt034Ayh_KtKZ+2Lh4ixLumiqGe0PvvkoL-wA@mail.gmail.com>
Not sure whether or not this is applicable in your situation, but could you
instead write a method that accepts a block?

Example:

def foo(i, really, want, these, args = {})
  yield(i, really, want, these, args) if block_given?
end

(obviously you could do other things in your method as well to DRY up
duplicate logic)


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.