dm-persevere-adapter 0.48.0 → 0.48.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.48.0
1
+ 0.48.1
@@ -26,11 +26,11 @@ module DataMapper
26
26
  json_hash = {}
27
27
 
28
28
  if type.eql?(DataMapper::Types::JsonReference)
29
- json_hash = { "type" => {"$ref" => "../#{@reference_class.storage_name}"}, "optional" => true }
29
+ json_hash = { "type" => {"$ref" => "../#{reference_class.storage_name}"}, "optional" => true }
30
30
  elsif type.eql?(DataMapper::Types::JsonReferenceCollection)
31
31
  json_hash = { "type" => "array",
32
32
  "optional" => true,
33
- "items" => {"$ref" => "../#{@reference_class.storage_name}"}
33
+ "items" => {"$ref" => "../#{reference_class.storage_name}"}
34
34
  }
35
35
  # "maxItems" => # For 0..3
36
36
  # "minItems" =>
@@ -48,5 +48,6 @@ module DataMapper
48
48
  # MAX
49
49
  json_hash
50
50
  end
51
+
51
52
  end
52
53
  end
@@ -9,6 +9,7 @@ require 'bigdecimal'
9
9
  require 'model_json_support'
10
10
  require 'persevere'
11
11
 
12
+ require 'types/property'
12
13
  require 'types/json_reference'
13
14
  require 'types/json_reference_collection'
14
15
 
@@ -41,7 +41,6 @@ module DataMapper
41
41
  def self.bind(property)
42
42
  property.instance_eval <<-RUBY, __FILE__, __LINE__ + 1
43
43
  def primitive?(value)
44
- puts "This is my primitive!"
45
44
 
46
45
  value.kind_of?(Array)
47
46
  end
@@ -51,15 +50,4 @@ module DataMapper
51
50
  end
52
51
  end
53
52
 
54
- class Property
55
- attr_accessor :reference_class
56
-
57
- alias initialize_without_reference_class initialize
58
- def initialize_with_reference_class(model, name, type, options = {})
59
- @reference_class = options.delete(:reference)
60
-
61
- initialize_without_reference_class(model, name, type, options)
62
- end
63
- alias initialize initialize_with_reference_class
64
- end
65
53
  end
@@ -0,0 +1,20 @@
1
+ module DataMapper
2
+ class Property
3
+
4
+ alias initialize_without_reference_class initialize
5
+ def initialize_with_reference_class(model, name, type, options = {})
6
+ @_reference_class = options.delete(:reference)
7
+
8
+ initialize_without_reference_class(model, name, type, options)
9
+ end
10
+ alias initialize initialize_with_reference_class
11
+
12
+ def reference_class
13
+ return @_reference_class if @_reference_class.kind_of?(Class)
14
+
15
+ @_reference_class = Extlib::Inflection.constantize(@_reference_class.to_s)
16
+
17
+ return @_reference_class
18
+ end
19
+ end
20
+ end
@@ -344,7 +344,7 @@ describe DataMapper::Adapters::PersevereAdapter do
344
344
  Author.auto_migrate!
345
345
  Comment.auto_migrate!
346
346
  Address.auto_migrate!
347
- BlogPost.send(:property, :comments, DataMapper::Types::JsonReferenceCollection, :reference => Comment)
347
+ BlogPost.send(:property, :comments, DataMapper::Types::JsonReferenceCollection, :reference => :Comment)
348
348
  BlogPost.auto_migrate!
349
349
  end
350
350
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 48
8
- - 0
9
- version: 0.48.0
8
+ - 1
9
+ version: 0.48.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ivan R. Judson
@@ -67,6 +67,7 @@ files:
67
67
  - lib/persevere_adapter.rb
68
68
  - lib/types/json_reference.rb
69
69
  - lib/types/json_reference_collection.rb
70
+ - lib/types/property.rb
70
71
  - persevere/History.txt
71
72
  - persevere/LICENSE.txt
72
73
  - persevere/Manifest.txt