ar_doc_store 0.0.4 → 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.
- checksums.yaml +4 -4
- data/lib/ar_doc_store/embeddable_model.rb +2 -10
- data/lib/ar_doc_store/version.rb +1 -1
- data/test/embedding_test.rb +11 -1
- data/test/test_helper.rb +19 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8976a8f0c31fe24e9670d9cb702c42e2e6bc2dab
|
4
|
+
data.tar.gz: f4cd0ed1f6623495a63a211b4d435b3541ac2594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015565bb5727c8156169edde09e3155cdb59f95907244e1d25821f36897ed0503669a3370c34891cfb12beaf6423c2513d4de0ab7732428e963e93d61250b132
|
7
|
+
data.tar.gz: 551012c6c8a78f4cc5378213073743637de2c99b2d2f84acedffbe7231bd7a5ceca47dc73f94ee602199ab23293e670b790dda8a3fbf5795a16f2eb396276241
|
@@ -8,16 +8,8 @@ module ArDocStore
|
|
8
8
|
attr_accessor :_destroy
|
9
9
|
attr_accessor :attributes
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
def self.virtual_attributes; @virtual_attributes; end
|
14
|
-
def self.virtual_attributes=(value); @virtual_attributes=value; end
|
15
|
-
def virtual_attributes; self.class.virtual_attributes; end
|
16
|
-
|
17
|
-
@columns_hash = HashWithIndifferentAccess.new
|
18
|
-
def self.columns_hash; @columns_hash; end
|
19
|
-
def self.columns_hash=(value); @columns_hash=value; end
|
20
|
-
def columns_hash; self.class.columns_hash; end
|
11
|
+
class_attribute :virtual_attributes
|
12
|
+
self.virtual_attributes ||= HashWithIndifferentAccess.new
|
21
13
|
|
22
14
|
delegate :as_json, to: :attributes
|
23
15
|
|
data/lib/ar_doc_store/version.rb
CHANGED
data/test/embedding_test.rb
CHANGED
@@ -29,5 +29,15 @@ class EmbeddingTest < MiniTest::Test
|
|
29
29
|
b.restrooms << r
|
30
30
|
assert !b.valid?
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
|
+
def test_model_with_no_attributes
|
34
|
+
item = ThingWithEmptyModel.new
|
35
|
+
item.build_empty_model
|
36
|
+
assert item.empty_model.is_a?(EmptyModel)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_model_subclassing
|
40
|
+
assert_equal EmbeddableB.virtual_attributes.size, 2
|
41
|
+
end
|
42
|
+
|
33
43
|
end
|
data/test/test_helper.rb
CHANGED
@@ -63,7 +63,25 @@ class ARDuck
|
|
63
63
|
def self.columns_hash
|
64
64
|
@@columns_hash ||= HashWithIndifferentAccess.new
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
class EmptyModel
|
70
|
+
include ArDocStore::EmbeddableModel
|
71
|
+
end
|
72
|
+
|
73
|
+
class ThingWithEmptyModel < ARDuck
|
74
|
+
include ArDocStore::Model
|
75
|
+
embeds_one :empty_model
|
76
|
+
end
|
77
|
+
|
78
|
+
class EmbeddableA < ARDuck
|
79
|
+
include ArDocStore::EmbeddableModel
|
80
|
+
attribute :name
|
81
|
+
end
|
82
|
+
|
83
|
+
class EmbeddableB < EmbeddableA
|
84
|
+
attribute :gender
|
67
85
|
end
|
68
86
|
|
69
87
|
class Dimensions
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_doc_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Furber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|