perpetuity 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
## Version 0.3
|
2
2
|
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-
|
6
|
-
|
7
|
-
- Add indexing
|
8
|
-
-
|
9
|
-
- Raise when calling Mapper[] with unmapped class
|
3
|
+
- Use `Perpetuity[]` instead of `Perpetuity::Mapper[]` to get mapper instances
|
4
|
+
- Allow subclassing of `Perpetuity::Mapper` with map macro
|
5
|
+
- Fix `select` calls using `id` as criteria from returning invalid or missing data
|
6
|
+
- Make MongoDB reads and writes fail fast
|
7
|
+
- Add indexing API to mappers
|
8
|
+
- Raise an exception when calling `Perpetuity[]` with a class that has no mapper
|
10
9
|
- Add unions and intersections to select queries for MongoDB adapter
|
11
10
|
- This allows for queries like `Perpetuity[Article].select { (created_at < Time.now) & (published == true) }`
|
12
11
|
- Update object in memory when calling `Mapper#update`
|
13
|
-
-
|
14
|
-
-
|
12
|
+
- Add `Mapper#save` to update an object's current state in the DB. Previously, we only had `#update` (primarily for `update` actions in Rails controllers).
|
13
|
+
- Silenced some ugly warnings
|
15
14
|
|
16
15
|
*Version 0.2 and 0.1 have no changelog because I am a terrible developer*
|
@@ -1,12 +1,8 @@
|
|
1
1
|
module Perpetuity
|
2
2
|
module DataInjectable
|
3
3
|
def inject_attribute object, attribute, value
|
4
|
-
|
5
|
-
|
6
|
-
else
|
7
|
-
attribute = "@#{attribute}" unless attribute[0] == '@'
|
8
|
-
object.instance_variable_set(attribute, value)
|
9
|
-
end
|
4
|
+
attribute = "@#{attribute}" unless attribute[0] == '@'
|
5
|
+
object.instance_variable_set(attribute, value)
|
10
6
|
end
|
11
7
|
|
12
8
|
def inject_data object, data
|
data/lib/perpetuity/retrieval.rb
CHANGED
@@ -69,13 +69,13 @@ module Perpetuity
|
|
69
69
|
if id
|
70
70
|
object = Reference.new(klass, id)
|
71
71
|
else
|
72
|
-
object = klass.
|
72
|
+
object = klass.allocate
|
73
73
|
data.each do |attr, value|
|
74
74
|
inject_attribute object, attr, unserialize(value)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
else
|
78
|
-
object = @class.
|
78
|
+
object = @class.allocate
|
79
79
|
data.each do |attr, value|
|
80
80
|
inject_attribute object, attr, unserialize(value)
|
81
81
|
end
|
@@ -9,11 +9,7 @@ module Perpetuity
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def attribute_for object, attribute_name
|
12
|
-
|
13
|
-
object.send(attribute_name)
|
14
|
-
else
|
15
|
-
object.instance_variable_get("@#{attribute_name}")
|
16
|
-
end
|
12
|
+
object.instance_variable_get("@#{attribute_name}")
|
17
13
|
end
|
18
14
|
|
19
15
|
def serialize object
|
data/lib/perpetuity/version.rb
CHANGED
@@ -30,7 +30,7 @@ module Perpetuity
|
|
30
30
|
|
31
31
|
it 'serializes attributes' do
|
32
32
|
object = Object.new
|
33
|
-
object.
|
33
|
+
object.instance_variable_set '@sub_objects', [unserializable_object]
|
34
34
|
mapper_class.attribute :sub_objects, embedded: true
|
35
35
|
mapper_class.map Object
|
36
36
|
data_source = double(:data_source)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perpetuity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|