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.



1690
1691
1692
1693
# File 'lib/textbringer/buffer.rb', line 1690

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

Instance Method Details

#add_action(action) ⇒ Object



1695
1696
1697
# File 'lib/textbringer/buffer.rb', line 1695

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

#redoObject



1705
1706
1707
1708
1709
# File 'lib/textbringer/buffer.rb', line 1705

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

#undoObject



1699
1700
1701
1702
1703
# File 'lib/textbringer/buffer.rb', line 1699

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