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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e752fc9f614a524bafc030fe5069640515bd5be
4
- data.tar.gz: e00abb95beef22026e5642c25b82a611fd38bd7f
3
+ metadata.gz: b7ee3f6f363b8913bdcd968206abe65ebd89c10c
4
+ data.tar.gz: 02220e0e01bd256b30b9163c5a9e31cd8b0cdd58
5
5
  SHA512:
6
- metadata.gz: d41f97d3f8c8ff85a9608ab9a0a479b52f95920c5c83f51b2d1809c2f58a61be927977e5910c4dfc3e34fd6434e210dad1d23a54f10d190bfd85444242c4af19
7
- data.tar.gz: 2e82c876c423289406c501274c554c1dedbcc7e619214f92811f6c86dae817a264c06851d6fd78af8b37cfda85e83e40270df09c0a637efe3d200c593e1dec95
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
- ::BSON::Binary.new(data, :uuid)
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 ::BSON::Binary
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 and object.mongoize
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
@@ -1,5 +1,5 @@
1
1
  module RUUID
2
2
  module Mongoid
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
@@ -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.0'
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.0
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-03 00:00:00.000000000 Z
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.0
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.0
40
+ version: 0.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement