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.
1817 1818 1819 1820 |
# File 'lib/textbringer/buffer.rb', line 1817 def initialize(buffer, location) super(buffer, location) @actions = [] end |
Instance Method Details
#add_action(action) ⇒ Object
1822 1823 1824 |
# File 'lib/textbringer/buffer.rb', line 1822 def add_action(action) @actions.push(action) end |
#redo ⇒ Object
1833 1834 1835 1836 1837 |
# File 'lib/textbringer/buffer.rb', line 1833 def redo @actions.each do |action| action.redo end end |
#undo ⇒ Object
1826 1827 1828 1829 1830 1831 |
# File 'lib/textbringer/buffer.rb', line 1826 def undo @actions.reverse_each do |action| action.undo end @buffer.goto_char(@location) end |