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.



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

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

Instance Method Details

#add_action(action) ⇒ Object



1830
1831
1832
# File 'lib/textbringer/buffer.rb', line 1830

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

#redoObject



1840
1841
1842
1843
1844
# File 'lib/textbringer/buffer.rb', line 1840

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

#undoObject



1834
1835
1836
1837
1838
# File 'lib/textbringer/buffer.rb', line 1834

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