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.



1592
1593
1594
1595
# File 'lib/textbringer/buffer.rb', line 1592

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

Instance Method Details

#add_action(action) ⇒ Object



1597
1598
1599
# File 'lib/textbringer/buffer.rb', line 1597

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

#redoObject



1607
1608
1609
1610
1611
# File 'lib/textbringer/buffer.rb', line 1607

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

#undoObject



1601
1602
1603
1604
1605
# File 'lib/textbringer/buffer.rb', line 1601

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