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.



1610
1611
1612
1613
# File 'lib/textbringer/buffer.rb', line 1610

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

Instance Method Details

#add_action(action) ⇒ Object



1615
1616
1617
# File 'lib/textbringer/buffer.rb', line 1615

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

#redoObject



1625
1626
1627
1628
1629
# File 'lib/textbringer/buffer.rb', line 1625

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

#undoObject



1619
1620
1621
1622
1623
# File 'lib/textbringer/buffer.rb', line 1619

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