PackingPeanut 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98a56da3d30642faebb8dda8ba695b5eb14bf95a
4
- data.tar.gz: 6025bffcaf7d9c5043f99d31280505e7bc2e52b6
3
+ metadata.gz: 12a47cd8b03f2575cbec3c3768afd5827e3459f7
4
+ data.tar.gz: 07bdafd4af83852cd593c96af077634284d3370f
5
5
  SHA512:
6
- metadata.gz: 5f38cf057b95e26e27e735bad06a1bde33a52939ad80f86a68ee911ce436066205ff5522ecc860d6d6182fd8172e8bbd45d47bff0eea9404979994ef1f3aa5bd
7
- data.tar.gz: bafbe8748b9b246aa8eb7153ccac0bea64359263740a25e7555c04a36cea99b25c76ffee1cb3ba7e9112678239772fe7a41584f4587de6bbdda59a3450f5eadd
6
+ metadata.gz: 2298a6a63b15c41318495495b3c9b64b30fe3f80c6f96673e92ba7df7f0c10331441b1ad4e99b217b2272123efe9995e83c68decc9161473f134ff0e07ca03ae
7
+ data.tar.gz: 44023b702723b79591bb23bad85b1c4d2f18c330515a382cdcada4bde59c8ae5ffc02aa17ca91faf8303f6369fbcdba451fad2bf476ad19a14b8603331acdcc9
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ![PackingPeanut Logo](./_art/logo_100.png) PackingPeanut
1
+ # ![PackingPeanut Logo](./_art/logo_100.png) PackingPeanut [![Gem Version](https://badge.fury.io/rb/PackingPeanut.svg)](http://badge.fury.io/rb/PackingPeanut)
2
2
 
3
3
  iOS has [BubbleWrap](https://github.com/rubymotion/BubbleWrap) for App Persistence : Android has PackingPeanut
4
4
 
@@ -18,7 +18,13 @@ There is a sedulous effort to make this syntax fit BubbleWrap's as much as possi
18
18
 
19
19
  ## Usage
20
20
 
21
- Example Usage from REPL
21
+ **It's as simple as:**
22
+ ```ruby
23
+ App::Persistence[:foo] = true
24
+ # App::Persistence[:foo] would now return true
25
+ ```
26
+
27
+ Whirlwind Tour via the REPL
22
28
  ```
23
29
  # PP automatically has context if the module is included
24
30
  # In this case we need to set the context
@@ -38,10 +44,10 @@ $ App::Persistence['dinner']
38
44
  => "" # empty because we're now outside the default storage file.
39
45
  $ App::Persistence.preference_mode = :world_readable
40
46
  => :world_redable
41
-
47
+ $ PP::Persistence['some_boolean'] = true #You can use PP instead of App if you like
42
48
  ```
43
49
 
44
- `App::Persistence` has been Aliasted to `PP::Persistence` for the bold.
50
+
45
51
 
46
52
  ## What are preference modes?
47
53
 
@@ -61,7 +67,10 @@ Memorizable symbols and their corresponding constants:
61
67
  ```
62
68
 
63
69
  ## Limitations?
64
- Achilles, the Death Star, and video game villians always have a significant catch. As of right now, you can only store strings, ints, and booleans. The data is serialized, and should support hashes, arrays, and floats but alas, I claim there be bugs in conversions via RM Android.
70
+ Achilles, the Death Star, and video game villians always have a significant catch. As of right now, you can only store **strings, ints, and booleans**. The data is serialized, and should support hashes, arrays, and floats but alas, I claim there be bugs in conversions via RM Android.
71
+
72
+ ## Tests?
73
+ Boy that would be nice wouldn't it?
65
74
 
66
75
  ## Contributing
67
76
 
@@ -1,16 +1,3 @@
1
-
2
- # Potential fixes for type specifics
3
- # Super fix #1 -> Serialize it: http://stackoverflow.com/questions/7057845/save-arraylist-to-sharedpreferences
4
- # ObjectSerializer: https://github.com/apache/pig/blob/89c2e8e76c68d0d0abe6a36b4e08ddc56979796f/src/org/apache/pig/impl/util/ObjectSerializer.java
5
- # https://pig.apache.org/releases.html
6
- # Super fix #2 -> Store depending on the class and retrieve with either
7
- # A: Failover defaults calling methods
8
- # B: Grab ALL data, and use that hash
9
- # Super fix #3 -> Serialize with JSON
10
- # new Gson().toJson(obj)
11
- # And for deserialization,
12
-
13
-
14
1
  module App
15
2
  module Persistence
16
3
 
@@ -45,6 +32,7 @@ module App
45
32
 
46
33
  def [](key)
47
34
  json_string = get_value(key)
35
+ return json_string if json_string == ""
48
36
  deserialize(key, json_string)
49
37
  end
50
38
 
@@ -60,7 +48,7 @@ module App
60
48
 
61
49
  def get_value key
62
50
  settings = get_settings
63
- value = settings.getString(key,nil)
51
+ settings.getString(key,nil)
64
52
  end
65
53
 
66
54
  def storage_file=(value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PackingPeanut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gant