Template Method その3
module TemplateMethod module Display def disp temp.each { |sym| __send__(sym) } end end class Parent include Display def temp a = [] a << :open a << [:_print] * 5 a << :close a.flatten end end class Child < Parent def initialize(str) @str = str end def open; print "<"; end def _print; print @str; end def close; puts ">"; end end end TemplateMethod::Child.new("H").disp
moduleを使ってみました。余計わからなくなりました。
難しいですね。