il Thu, 17 Jun 2004 00:10:40 +0900, Florian Weber <csshsh / structbench.com> ha scritto:: >hi! > >i have a design question. for example i have a class which reads a file >and prints out each line with line numbers. what if now i wanna be able >to plugin some functionality which sorts the file, depending on some >conditions (extension, etc) before its passed on to the line numbering >functionality. the class should be as less tied as possible to the >sorting >functionality as possible.. > >how would you normally design that in ruby? I'd say that you could use some kind of pattern and so on. You may find this thread useful: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/48648 As of now I'd probably use some trick similar to this: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/97440 to allow the user to write something like add_filter(:read) do.. end