mongomatic 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mongomatic/type_converters.rb +13 -13
  2. metadata +2 -2
@@ -30,7 +30,7 @@ module Mongomatic
30
30
 
31
31
  class String < Base
32
32
  def type_match?
33
- @orig_val.class.to_s == "String"
33
+ @orig_val.kind_of? ::String
34
34
  end
35
35
 
36
36
  def convert_orig_val
@@ -40,7 +40,7 @@ module Mongomatic
40
40
 
41
41
  class Float < Base
42
42
  def type_match?
43
- @orig_val.class.to_s == "Float"
43
+ @orig_val.kind_of? ::Float
44
44
  end
45
45
 
46
46
  def convert_orig_val
@@ -50,7 +50,7 @@ module Mongomatic
50
50
 
51
51
  class Fixnum < Base
52
52
  def type_match?
53
- @orig_val.class.to_s == "Fixnum"
53
+ @orig_val.kind_of? ::Fixnum
54
54
  end
55
55
 
56
56
  def convert_orig_val
@@ -60,7 +60,7 @@ module Mongomatic
60
60
 
61
61
  class Array < Base
62
62
  def type_match?
63
- @orig_val.class.to_s == "Array"
63
+ @orig_val.kind_of? ::Array
64
64
  end
65
65
 
66
66
  def convert_orig_val
@@ -70,7 +70,7 @@ module Mongomatic
70
70
 
71
71
  class Hash < Base
72
72
  def type_match?
73
- @orig_val.class.to_s == "Hash"
73
+ @orig_val.kind_of? ::Hash
74
74
  end
75
75
 
76
76
  def convert_orig_val
@@ -100,11 +100,11 @@ module Mongomatic
100
100
 
101
101
  class Time < Base
102
102
  def type_match?
103
- @orig_val.class.to_s == "Time"
103
+ @orig_val.kind_of? ::Time
104
104
  end
105
105
 
106
106
  def convert_orig_val
107
- Time.parse(@orig_val.to_s)
107
+ ::Time.parse(@orig_val.to_s)
108
108
  rescue ArgumentError => e
109
109
  nil
110
110
  end
@@ -112,17 +112,17 @@ module Mongomatic
112
112
 
113
113
  class Regex < Base
114
114
  def type_match?
115
- @orig_val.class.to_s == "Regexp"
115
+ @orig_val.kind_of? ::Regexp
116
116
  end
117
117
 
118
118
  def convert_orig_val
119
- Regexp.new(@orig_val.to_s)
119
+ ::Regexp.new(@orig_val.to_s)
120
120
  end
121
121
  end
122
122
 
123
123
  class Symbol < Base
124
124
  def type_match?
125
- @orig_val.class.to_s == "Symbol"
125
+ @orig_val.kind_of? ::Symbol
126
126
  end
127
127
 
128
128
  def convert_orig_val
@@ -132,12 +132,12 @@ module Mongomatic
132
132
 
133
133
  class ObjectId < Base
134
134
  def type_match?
135
- @orig_val.class.to_s == "BSON::ObjectId"
135
+ @orig_val.kind_of? ::BSON::ObjectId
136
136
  end
137
137
 
138
138
  def convert_orig_val
139
- BSON::ObjectId(@orig_val.to_s)
140
- rescue BSON::InvalidObjectId => e
139
+ ::BSON::ObjectId(@orig_val.to_s)
140
+ rescue ::BSON::InvalidObjectId => e
141
141
  nil
142
142
  end
143
143
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 4
9
- version: 0.6.4
8
+ - 5
9
+ version: 0.6.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Myles