Browse files

add save_interval

  • Loading branch information...
1 parent 33961c3 commit 20c7a882f0907be005799acaf985b67f2f5d5a99 @siuying committed May 11, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −1 README.md
  2. +4 −0 lib/nano_store/store_extension.rb
  3. +1 −1 spec/store_extension_spec.rb
View
2 README.md
@@ -148,7 +148,7 @@ NanoStore by defaults saves every object to disk one by one. To speed up inserts
store = NanoStore.shared_store = NanoStore.store
# Increase the save interval
-store.saveInterval = 1000
+store.save_interval = 1000
# Do a bunch of inserts and/or edits
obj1 = Animal.new
View
4 lib/nano_store/store_extension.rb
@@ -6,6 +6,10 @@ def engine
def changed?
self.hasUnsavedChanges
end
+
+ def save_interval=(interval)
+ self.setSaveInterval(interval)
+ end
## Open and Close store
View
2 spec/store_extension_spec.rb
@@ -53,7 +53,7 @@ class Animal < NanoStore::Model
it "should discard unsave changes" do
store = NanoStore.shared_store = NanoStore.store
- store.saveInterval = 1000 # must use setInterval to set auto save interval first
+ store.save_interval = 1000 # must use save_interval= to set auto save interval first
store.engine.synchronousMode = SynchronousModeFull
Animal.count.should == 0

0 comments on commit 20c7a88

Please sign in to comment.