Posts Tagged ‘Command patten’

Ruby Design Patten — Command patten

Share a design patten: Command patten. Migration in Ruby On Rails is a good example of Command patten. Bellow is code about how to create a Command patten in Ruby. The code bellow defined CreateFile and CopyFile two classes, use Command patten and Composite patten log requests, and support undoable operations. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374class Command   attr_reader [...]