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.



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

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

Instance Method Details

#add_action(action) ⇒ Object



1632
1633
1634
# File 'lib/textbringer/buffer.rb', line 1632

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

#redoObject



1642
1643
1644
1645
1646
# File 'lib/textbringer/buffer.rb', line 1642

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

#undoObject



1636
1637
1638
1639
1640
# File 'lib/textbringer/buffer.rb', line 1636

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