Inspired by BubbleWrap's easy syntax for App Persistence - Now a CROSS PLATFORM App Persistence Gem for RubyMotion.

There is a sedulous effort to make this syntax fit BubbleWrap's as much as possible for easy replacement.


Step 1: Add this line to your application's Gemfile:

gem 'PackingPeanut'

Step 2: And then execute:

$ bundle

Step 3: For Android Only

  $ [bundle exec] rake gradle:install


Example Usage from REPL

# PP automatically has context if the module is included
# Only android needs context
$ App::Persistence.context = self
=> #<MainActivity:0x1d20058e>
$ App::Persistence['dinner'] = "nachos"
=> "nachos"
$ App::Persistence['dinner'] 
=> "nachos"
$ App::Persistence['lunch'] = "tacos"
=> "tacos"
$ App::Persistence.all
=> {"dinner"=>"nachos", "lunch"=>"tacos"}
$ App::Persistence.storage_file = "some_new_file"
=> "some_new_file"
$ App::Persistence['dinner']
=> ""  # empty because we're now outside the default storage file.

App::Persistence has been Aliasted to PP for the bold.