mongocore 0.1.4 → 0.1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mongocore/document.rb +9 -5
- data/mongocore.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82ab8bff97378c5d4201d927c111a9975d3a1b66
|
4
|
+
data.tar.gz: a4c9fb66a260bc63c7bebc73a2420e268efbfa79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b946978a281316973d65c9f93d814a8c8b44eb84f11c71839bc994b77619632a3486750b99517408159080ab3616dd323a7db4540d1cc8c4274fb51250a15de
|
7
|
+
data.tar.gz: b5f1b9c1eace40133164715217fec0ebc14a977b9be9a38b90b8044297a3c12d4581750fdc7c474897e6871db097e1bca5427a3fac49eacf106347775cba5c3b
|
data/lib/mongocore/document.rb
CHANGED
@@ -49,7 +49,6 @@ module Mongocore
|
|
49
49
|
# Pass in attributes you want to set: Model.new(:duration => 60)
|
50
50
|
# Defaults are filled in automatically.
|
51
51
|
#
|
52
|
-
|
53
52
|
def initialize(a = {})
|
54
53
|
a = a.deep_symbolize_keys
|
55
54
|
|
@@ -117,7 +116,7 @@ module Mongocore
|
|
117
116
|
|
118
117
|
# Collect the attributes, pass tags like defined in your model yml
|
119
118
|
def attributes(*tags)
|
120
|
-
a = {}; self.class.schema.attributes(tags.map(&:to_s)).each{|k| a[k] = read!(k)}; a
|
119
|
+
a = {}; self.class.schema.attributes(tags.map(&:to_s)).each{|k| a[k] = read!(k)}; string_id(a)
|
121
120
|
end
|
122
121
|
|
123
122
|
# Set the attributes
|
@@ -130,9 +129,9 @@ module Mongocore
|
|
130
129
|
changes.any?
|
131
130
|
end
|
132
131
|
|
133
|
-
# JSON format
|
134
|
-
def
|
135
|
-
|
132
|
+
# JSON format
|
133
|
+
def as_json(options = {})
|
134
|
+
attributes
|
136
135
|
end
|
137
136
|
|
138
137
|
|
@@ -231,6 +230,11 @@ module Mongocore
|
|
231
230
|
@_id ? @_id.to_s : nil
|
232
231
|
end
|
233
232
|
|
233
|
+
# Replace _id with id, takes a hash
|
234
|
+
def string_id(a)
|
235
|
+
a.delete(:_id); {:id => id}.merge(a)
|
236
|
+
end
|
237
|
+
|
234
238
|
end
|
235
239
|
|
236
240
|
|
data/mongocore.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongocore'
|
3
|
-
s.version = '0.1.4'
|
4
|
-
s.date = '2017-10-
|
3
|
+
s.version = '0.1.4.1'
|
4
|
+
s.date = '2017-10-16'
|
5
5
|
s.summary = "MongoDB ORM implementation on top of the Ruby MongoDB driver"
|
6
6
|
s.description = "Does validations, associations, scopes, filters, pagination, counter cache, request cache, and nested queries. Using a YAML schema file, which supports default values, data types, and security levels for each key."
|
7
7
|
s.authors = ["Fugroup Limited"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongocore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.4
|
4
|
+
version: 0.1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fugroup Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongo
|