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.



1727
1728
1729
1730
# File 'lib/textbringer/buffer.rb', line 1727

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

Instance Method Details

#add_action(action) ⇒ Object



1732
1733
1734
# File 'lib/textbringer/buffer.rb', line 1732

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

#redoObject



1742
1743
1744
1745
1746
# File 'lib/textbringer/buffer.rb', line 1742

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

#undoObject



1736
1737
1738
1739
1740
# File 'lib/textbringer/buffer.rb', line 1736

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