Module: Ruco::Editor::History

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#historyObject (readonly)

Returns the value of attribute history.



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

def history
  @history
end

Instance Method Details

#initialize(content, options) ⇒ Object



6
7
8
9
# File 'lib/ruco/editor/history.rb', line 6

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

#redoObject



16
17
18
19
# File 'lib/ruco/editor/history.rb', line 16

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

#undoObject



11
12
13
14
# File 'lib/ruco/editor/history.rb', line 11

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

#viewObject



21
22
23
24
# File 'lib/ruco/editor/history.rb', line 21

def view
  @history.add(state)
  super
end