Class: Textbringer::CompositeAction
- Inherits:
-
UndoableAction
- Object
- UndoableAction
- Textbringer::CompositeAction
- Defined in:
- lib/textbringer/buffer.rb
Instance Attribute Summary
Attributes inherited from UndoableAction
Instance Method Summary collapse
- #add_action(action) ⇒ Object
-
#initialize(buffer, location) ⇒ CompositeAction
constructor
A new instance of CompositeAction.
- #redo ⇒ Object
- #undo ⇒ Object
Constructor Details
#initialize(buffer, location) ⇒ CompositeAction
Returns a new instance of CompositeAction.
1852 1853 1854 1855 |
# File 'lib/textbringer/buffer.rb', line 1852 def initialize(buffer, location) super(buffer, location) @actions = [] end |
Instance Method Details
#add_action(action) ⇒ Object
1857 1858 1859 |
# File 'lib/textbringer/buffer.rb', line 1857 def add_action(action) @actions.push(action) end |
#redo ⇒ Object
1868 1869 1870 1871 1872 |
# File 'lib/textbringer/buffer.rb', line 1868 def redo @actions.each do |action| action.redo end end |
#undo ⇒ Object
1861 1862 1863 1864 1865 1866 |
# File 'lib/textbringer/buffer.rb', line 1861 def undo @actions.reverse_each do |action| action.undo end @buffer.goto_char(@location) end |