Module: Ruco::Editor::History

Included in:
Ruco::EditorArea
Defined in:
lib/ruco/editor/history.rb

Instance Method Summary collapse

Instance Method Details

#initialize(content, options) ⇒ Object



4
5
6
7
# File 'lib/ruco/editor/history.rb', line 4

def initialize(content, options)
  super(content, options)
  @history = Ruco::History.new((options[:history]||{}).reverse_merge(:state => state, :track => [:content], :entries => 100, :timeout => 2))
end

#redoObject



14
15
16
17
# File 'lib/ruco/editor/history.rb', line 14

def redo
  @history.redo
  self.state = @history.state
end

#undoObject



9
10
11
12
# File 'lib/ruco/editor/history.rb', line 9

def undo
  @history.undo
  self.state = @history.state
end

#viewObject



19
20
21
22
# File 'lib/ruco/editor/history.rb', line 19

def view
  @history.add(state)
  super
end