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.



1808
1809
1810
1811
# File 'lib/textbringer/buffer.rb', line 1808

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

Instance Method Details

#add_action(action) ⇒ Object



1813
1814
1815
# File 'lib/textbringer/buffer.rb', line 1813

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

#redoObject



1823
1824
1825
1826
1827
# File 'lib/textbringer/buffer.rb', line 1823

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

#undoObject



1817
1818
1819
1820
1821
# File 'lib/textbringer/buffer.rb', line 1817

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