kyoto_record 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/kyoto_record.gemspec +1 -1
- data/kyoto_record.rb +2 -3
- data/kyoto_record_spec.rb +11 -0
- metadata +1 -1
data/kyoto_record.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "kyoto_record"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.5"
|
4
4
|
s.summary = "Persist your classes in Kyoto Cabinet."
|
5
5
|
s.description = "\"KyotoRecord\": Kyoto Cabinet wrapper for Ruby binding. Scannable. Indexable. A programming interface made for babies."
|
6
6
|
s.homepage = "http://github.com/thirdreplicator/kyoto_record"
|
data/kyoto_record.rb
CHANGED
@@ -6,12 +6,11 @@ module KyotoRecord
|
|
6
6
|
# Refactored out this module so that it can be reused in the class 'Index'
|
7
7
|
# as well as the module ClassMethds, which is directly enhancing the
|
8
8
|
# user-defined data model class.
|
9
|
-
|
9
|
+
DATA_DIR = './data'
|
10
|
+
|
10
11
|
module Cabinet
|
11
12
|
include KyotoCabinet
|
12
13
|
|
13
|
-
DATA_DIR = './data'
|
14
|
-
|
15
14
|
def find(id)
|
16
15
|
value = @db.get(id)
|
17
16
|
if value
|
data/kyoto_record_spec.rb
CHANGED
@@ -19,6 +19,17 @@ describe 'KyotoRecord module' do
|
|
19
19
|
File.exist?('./data/A.kch').should be_true
|
20
20
|
end
|
21
21
|
|
22
|
+
it "should have a globally configurable data directory" do
|
23
|
+
KyotoRecord::DATA_DIR = '/tmp/kr'
|
24
|
+
class B
|
25
|
+
include KyotoRecord
|
26
|
+
attr_kyoto :x
|
27
|
+
end
|
28
|
+
File.exist?('/tmp/kr/B.kch').should be_true
|
29
|
+
`rm -rf /tmp/kr` # Clean up.
|
30
|
+
KyotoRecord::DATA_DIR = './data' # Revert global config back to normal.
|
31
|
+
end
|
32
|
+
|
22
33
|
it "find should return an instance of the enhanced user-defined class" do
|
23
34
|
@a = A.new
|
24
35
|
@a.x = 3
|