Composite of Commands Design Pattern
问题 Does anyone have a good example in Ruby of using a Composite of Commands? It is a design pattern hybrid that I have seen mentioned in various Design Patterns literature which sounds quite powerful, but have not been able to find any interesting use cases or code. 回答1: Inspired by the general idea and the sample pattern implementations in this blog post, here's a stab at what it might look like: class CompositeCommand def initialize(description, command, undo) @description=description;