mongoid_alize 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid/alize/to_callback.rb +6 -5
- data/spec/app/models/head.rb +1 -1
- data/spec/app/models/person.rb +2 -2
- data/spec/spec_helper.rb +19 -5
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8787d5a6ebd7c17e2619267de0cb2c3b536dad5b
|
4
|
+
data.tar.gz: 1953945ef586e4ab4d319a22cd9acc1abb58e5b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a40f35a37a71b24f599f4acb73ebac65622e033ac1b1583b2a551c605690818b75fc422a7bae072cc3af4bd74d39e44360b285d972ad56eec563f491e58b3a
|
7
|
+
data.tar.gz: 0f6bb6a4efc21d697e723ab9ab5219dea616d4134bf9f80662beb1ddb0da97268ed85da0d9943d1961d770ebbc8817e24e7b763fb5b7eac12460a4e2f0d70010
|
@@ -91,15 +91,15 @@ module Mongoid
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def relation_set(field, value)
|
94
|
-
|
94
|
+
mongoid_four_or_newer? ? "relation.set(#{field} => #{value})" : "relation.set(#{field}, #{value})"
|
95
95
|
end
|
96
96
|
|
97
97
|
def relation_pull(field, value)
|
98
|
-
|
98
|
+
mongoid_four_or_newer? ? "relation.pull(#{field} => #{value})" : "relation.pull(#{field}, #{value})"
|
99
99
|
end
|
100
100
|
|
101
101
|
def relation_push(field, value)
|
102
|
-
|
102
|
+
mongoid_four_or_newer? ? "relation.push(#{field} => #{value})" : "relation.push(#{field}, #{value})"
|
103
103
|
end
|
104
104
|
|
105
105
|
def is_one?
|
@@ -155,9 +155,10 @@ module Mongoid
|
|
155
155
|
"to"
|
156
156
|
end
|
157
157
|
|
158
|
-
def
|
159
|
-
Mongoid::VERSION
|
158
|
+
def mongoid_four_or_newer?
|
159
|
+
Mongoid::VERSION.split('.').first.to_i >= 4
|
160
160
|
end
|
161
|
+
|
161
162
|
end
|
162
163
|
end
|
163
164
|
end
|
data/spec/app/models/head.rb
CHANGED
data/spec/app/models/person.rb
CHANGED
@@ -2,14 +2,14 @@ class Person
|
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Alize
|
4
4
|
|
5
|
-
if SpecHelper.
|
5
|
+
if SpecHelper.mongoid_four_or_newer?
|
6
6
|
include Mongoid::Attributes::Dynamic
|
7
7
|
end
|
8
8
|
|
9
9
|
field :name, type: String
|
10
10
|
field :created_at, type: Time
|
11
11
|
|
12
|
-
if SpecHelper.
|
12
|
+
if SpecHelper.mongoid_three_or_newer?
|
13
13
|
field :my_date, type: Date
|
14
14
|
field :my_datetime, type: DateTime
|
15
15
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,23 +7,37 @@ unless ENV['CI']
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module SpecHelper
|
10
|
+
|
11
|
+
# for mongoize_spec
|
10
12
|
def self.mongoid_3?
|
11
|
-
defined?(Mongoid::VERSION) && Mongoid::VERSION
|
13
|
+
defined?(Mongoid::VERSION) && Mongoid::VERSION.split('.').first.to_i == 3
|
14
|
+
end
|
15
|
+
|
16
|
+
# different connection scheme starting with three
|
17
|
+
def self.mongoid_three_or_newer?
|
18
|
+
defined?(Mongoid::VERSION) && Mongoid::VERSION.split('.').first.to_i >= 3
|
12
19
|
end
|
13
20
|
|
14
|
-
|
15
|
-
|
21
|
+
# dynamic attributes required starting with four
|
22
|
+
def self.mongoid_four_or_newer?
|
23
|
+
defined?(Mongoid::VERSION) && Mongoid::VERSION.split('.').first.to_i >= 4
|
16
24
|
end
|
25
|
+
|
17
26
|
end
|
18
27
|
|
19
28
|
Mongoid.configure do |config|
|
20
|
-
|
21
|
-
|
29
|
+
|
30
|
+
if defined?(Moped)
|
22
31
|
Moped.logger = Logger.new($stdout)
|
23
32
|
Moped.logger.level = Logger::INFO
|
24
33
|
else
|
25
34
|
logger = Logger.new($stdout)
|
26
35
|
logger.level = Logger::INFO
|
36
|
+
end
|
37
|
+
|
38
|
+
if SpecHelper.mongoid_three_or_newer?
|
39
|
+
config.connect_to("mongoid_alize_test")
|
40
|
+
else
|
27
41
|
config.master = Mongo::Connection.new("localhost", 27017,
|
28
42
|
:logger => logger).db("mongoid_alize_test")
|
29
43
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_alize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Dzielak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.6.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.6.0
|
41
41
|
description: Keep data in sync as you denormalize across any type of relation.
|
@@ -85,19 +85,18 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.4.5
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Comprehensive field denormalization for Mongoid that stays in sync.
|
102
102
|
test_files: []
|
103
|
-
has_rdoc:
|