ssd 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/ssd.rb +3 -3
- data/lib/ssd/version.rb +1 -1
- data/specs/ssd_spec.rb +3 -3
- 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: 66fbedba3d0cd3cae41d234f436fd58b706d0fd7
|
4
|
+
data.tar.gz: 13b3f1c961041b5ce1f3b93b961597c374dd1b90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2afea1097690895891a0cd9c7f6e6037ef8e53cc0e5db637e86426ee518dfd777097afd6e9f6b9e562a1ff1e9436695f6548d737951f07f123e2b555a5dbe4cc
|
7
|
+
data.tar.gz: 7bf3abe7e9b32b7fe3b7b8f31f00278acc8cb36e7fa8c468ae0cce283743d8cbfe9649216233fd0306e9b0fb157da3cc9639a62bf5d42872870375e36d15603d
|
data/README.md
CHANGED
@@ -24,18 +24,20 @@ SSD is carefully crafted to scale specially-well with the Microservies Architetu
|
|
24
24
|
Usage
|
25
25
|
======
|
26
26
|
```ruby
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
module MyApp
|
28
|
+
class User
|
29
|
+
include SSD
|
30
|
+
attr_accessor :id # ssd key
|
31
|
+
end
|
31
32
|
|
32
|
-
class API
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
class API < Sinatra::Base
|
34
|
+
get '/' do
|
35
|
+
@user = User.new # Initialize an object form any Class that `include SSD`
|
36
|
+
@user.id = "generated_id" # Give it an ssd key via it's :id
|
37
|
+
@user.append! # Do an `append!` operation and viola! DONE
|
38
|
+
User.ssd("generated_id") # Later to read it via Class.ssd(id)
|
39
|
+
end
|
40
|
+
end
|
39
41
|
end
|
40
42
|
```
|
41
43
|
|
data/lib/ssd.rb
CHANGED
@@ -113,7 +113,7 @@ module SSD
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
def
|
116
|
+
def ssd id
|
117
117
|
#TODO add raise if id.nil?
|
118
118
|
last_key = (last_key id)
|
119
119
|
@@ssd_db.transaction true do
|
@@ -121,8 +121,8 @@ module SSD
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
alias get fetch
|
125
|
-
alias find fetch
|
124
|
+
#alias get fetch
|
125
|
+
#alias find fetch
|
126
126
|
|
127
127
|
def delete *ids
|
128
128
|
@@ssd_db.transaction do
|
data/lib/ssd/version.rb
CHANGED
data/specs/ssd_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe SSD do
|
|
27
27
|
@user = User.new
|
28
28
|
@user.id = @generated_id
|
29
29
|
@user.append!
|
30
|
-
user = User.
|
30
|
+
user = User.ssd(@generated_id)
|
31
31
|
user.id.must_equal @generated_id
|
32
32
|
end
|
33
33
|
end
|
@@ -40,11 +40,11 @@ describe SSD do
|
|
40
40
|
@user.location = "Egypt"
|
41
41
|
@user.append!
|
42
42
|
|
43
|
-
@user = User.
|
43
|
+
@user = User.ssd(@generated_id)
|
44
44
|
@user.location = "Brazil"
|
45
45
|
@user.append!
|
46
46
|
|
47
|
-
@user = User.
|
47
|
+
@user = User.ssd(@generated_id)
|
48
48
|
@user.location = "France"
|
49
49
|
@user.append!
|
50
50
|
|