3 ## Implements a single undo list for the Sup instance
5 ## The basic idea is to keep a list of lambdas to undo
6 ## things. When an action is called (such as 'archive'),
7 ## a lambda is registered with UndoManager that will
8 ## undo the archival action
15 self.class.i_am_the_instance self
18 def register desc, *actions, &b
19 actions = [*actions.flatten]
21 raise ArgumentError, "need at least one action" unless actions.length > 0
22 @@actionlist.push :desc => desc, :actions => actions
26 unless @@actionlist.empty?
27 actionset = @@actionlist.pop
28 actionset[:actions].each { |action| action.call }
29 BufferManager.flash "undid #{actionset[:desc]}"
31 BufferManager.flash "nothing more to undo!"