Borges::StateHolder (Class)

In: lib/Borges/Utilities/StateHolder.rb
Parent: Object

A Borges::StateHolder backtracks itself, restoring previous versions of the object it holds when a user uses the back button. The StateHolder does not backtrack the object it holds.

For example:

  obj = 5
  st = Borges::StateHolder.new obj
  # page is rendered, user causes this action to take place:
  st.contents = 7
  # user goes back to the first page
  puts st.contents # => 5

Methods

new  

Attributes

contents  [RW]  The object the StateHolder should backtrack.

Public Class methods

Wraps object, and registers the StateHolder for backtracking.

[Validate]