ssd 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/ssd.rb +3 -3
- data/lib/ssd/version.rb +1 -1
- data/specs/ssd_spec.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b92b6965932b8d802b091967ab77bb96bc70aeb
|
4
|
+
data.tar.gz: 31f3d7183f06ebf5bcfb994f9ea98dcce56f25b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ab0c3636b09dffd47ed82beb7f5f1bdd1ffc149822b172e6be1d8269e8eb9acf33a28c9f365b2c3d8621c5f230189546c38ae1fd2ae5a098abe1462f18f912
|
7
|
+
data.tar.gz: 4b8a3d685f228d66a99ab8791603c7819b316e6e4ad1669c516b35a2fa37d22ff5880eed16c5c05ce2f8c39c56e05b91415a5cb4b60e56afcf6ad860ea5c0fbe
|
data/README.md
CHANGED
@@ -28,6 +28,15 @@ class User
|
|
28
28
|
include SSD
|
29
29
|
attr_accessor :id # ssd key
|
30
30
|
end
|
31
|
+
|
32
|
+
class API
|
33
|
+
get '\' do
|
34
|
+
@user = User.new # Initialize an object form any Class that `include SSD`
|
35
|
+
@user.id = "generated_id" # Give it an ssd key via it's :id
|
36
|
+
@user.append # Do an `append` operation and viola! DONE
|
37
|
+
User.get("generated_id") # Later to read it via Class.get(id)
|
38
|
+
end
|
39
|
+
end
|
31
40
|
```
|
32
41
|
|
33
42
|
Concerns FAQs
|
data/lib/ssd.rb
CHANGED
data/lib/ssd/version.rb
CHANGED
data/specs/ssd_spec.rb
CHANGED
@@ -11,12 +11,12 @@ describe SSD do
|
|
11
11
|
@generated_id = Random.new.seed
|
12
12
|
end
|
13
13
|
|
14
|
-
describe "#append" do
|
14
|
+
describe "#append!" do
|
15
15
|
it "saves an object to the database" do
|
16
16
|
#skip
|
17
17
|
@user = User.new
|
18
18
|
@user.id = @generated_id
|
19
|
-
@user.append
|
19
|
+
@user.append!
|
20
20
|
@user.id.must_equal @generated_id
|
21
21
|
end
|
22
22
|
end
|
@@ -26,27 +26,27 @@ describe SSD do
|
|
26
26
|
# skip
|
27
27
|
@user = User.new
|
28
28
|
@user.id = @generated_id
|
29
|
-
@user.append
|
29
|
+
@user.append!
|
30
30
|
user = User.get(@generated_id)
|
31
31
|
user.id.must_equal @generated_id
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe "an append
|
35
|
+
describe "an append!-only operations" do
|
36
36
|
it "it keeps adding new objects" do
|
37
37
|
@user = User.new
|
38
38
|
|
39
39
|
@user.id = @generated_id
|
40
40
|
@user.location = "Egypt"
|
41
|
-
@user.append
|
41
|
+
@user.append!
|
42
42
|
|
43
43
|
@user = User.get(@generated_id)
|
44
44
|
@user.location = "Brazil"
|
45
|
-
@user.append
|
45
|
+
@user.append!
|
46
46
|
|
47
47
|
@user = User.get(@generated_id)
|
48
48
|
@user.location = "France"
|
49
|
-
@user.append
|
49
|
+
@user.append!
|
50
50
|
|
51
51
|
User.count(@generated_id).must_equal 3
|
52
52
|
end
|