[]=

[]=(name, value)
Instance Public methods

Stores an individual Ruby object or a hierarchy of Ruby objects in the data store file under the root name. Assigning to a name already in the data store clobbers the old data.

Example:

require "pstore"

store = PStore.new("data_file.pstore")
store.transaction do  # begin transaction
  # load some data into the store...
  store[:single_object] = "My data..."
  store[:obj_heirarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"],
                            "James Gray"  => ["erb.rb", "pstore.rb"] }
end                   # commit changes to data store file

WARNING: This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.

doc_ruby_on_rails
2015-04-29 00:32:49
Comments
Leave a Comment

Please login to continue.