Class: Textbringer::CompositeAction

Inherits:
UndoableAction show all
Defined in:
lib/textbringer/buffer.rb

Instance Attribute Summary

Attributes inherited from UndoableAction

#location, #version

Instance Method Summary collapse

Constructor Details

#initialize(buffer, location) ⇒ CompositeAction

Returns a new instance of CompositeAction.



1996
1997
1998
1999
# File 'lib/textbringer/buffer.rb', line 1996

def initialize(buffer, location)
  super(buffer, location)
  @actions = []
end

Instance Method Details

#add_action(action) ⇒ Object



2001
2002
2003
# File 'lib/textbringer/buffer.rb', line 2001

def add_action(action)
  @actions.push(action)
end

#redoObject



2011
2012
2013
2014
2015
# File 'lib/textbringer/buffer.rb', line 2011

def redo
  @actions.each do |action|
    action.redo
  end
end

#undoObject



2005
2006
2007
2008
2009
# File 'lib/textbringer/buffer.rb', line 2005

def undo
  @actions.reverse_each do |action|
    action.undo
  end
end