ruuid-mongoid 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruuid/mongoid/extensions/uuid.rb +6 -3
- data/lib/ruuid/mongoid/version.rb +1 -1
- data/ruuid-mongoid.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ee3f6f363b8913bdcd968206abe65ebd89c10c
|
4
|
+
data.tar.gz: 02220e0e01bd256b30b9163c5a9e31cd8b0cdd58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3beffefb7cfc6cebf537d3f1b11a867e5ce8dc43175389c89c1baae035bde276d896df00fc90fe5ac595635a77125dbc40462b48119116c5503d8b6404a69f5
|
7
|
+
data.tar.gz: 47c1180c5d7b49caf4ff922bf44c867ee2f7d5b54246b773828c5c3789def55ed50690313c5ad76a122d7863f58ca48ea2fde070d72a698a7c7bd92fbf6e7b5f
|
@@ -8,9 +8,11 @@ module RUUID
|
|
8
8
|
# @return [BSON::Binary]
|
9
9
|
# The mongoized object.
|
10
10
|
def mongoize
|
11
|
-
|
11
|
+
BSON::Binary.new(data, :uuid)
|
12
12
|
end
|
13
13
|
|
14
|
+
delegate :bson_type, :to_bson, to: :mongoize
|
15
|
+
|
14
16
|
module ClassMethods
|
15
17
|
# Convert the object from its Mongo-friendly Ruby type to this type.
|
16
18
|
#
|
@@ -21,7 +23,7 @@ module RUUID
|
|
21
23
|
# The demongoized UUID.
|
22
24
|
def demongoize(object)
|
23
25
|
case object
|
24
|
-
when
|
26
|
+
when BSON::Binary
|
25
27
|
new(object.data)
|
26
28
|
when ::String
|
27
29
|
parse(object)
|
@@ -39,7 +41,8 @@ module RUUID
|
|
39
41
|
# @return [BSON::Binary]
|
40
42
|
# The mongoized object.
|
41
43
|
def mongoize(object)
|
42
|
-
object
|
44
|
+
return object if object.nil?
|
45
|
+
parse(object).mongoize rescue object.mongoize
|
43
46
|
end
|
44
47
|
alias_method :evolve, :mongoize
|
45
48
|
end
|
data/ruuid-mongoid.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = %w[lib]
|
18
18
|
|
19
19
|
spec.add_dependency 'mongoid', '~> 4.0'
|
20
|
-
spec.add_dependency 'ruuid', '~> 0.2.
|
20
|
+
spec.add_dependency 'ruuid', '~> 0.2.1'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
23
23
|
spec.add_development_dependency 'pry', '~> 0.10.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruuid-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.
|
40
|
+
version: 0.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|