kyoto_record 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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"
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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kyoto_record
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Beckwith