mincer 0.2.16 → 0.2.17
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a35780354d1a3d2c9850f6fa83996366c57485
|
4
|
+
data.tar.gz: 0e23085677d40f3a96560fd1bab2a90d16b03194
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: add1d84d8e9595801b82e1c906baf72fb9fa33f684cf905927b6a26eaa2a97fef8267466291d4456ed2e285269ab5aca4c7388b85c4707e2b8063b01bf8187fb
|
7
|
+
data.tar.gz: 5bb7915aa9b8e816a543928f05a26878bd54e2477bea8af9f41560e6e14ef1afc0284bcfdeaba468e4c0961b8bd248746594ba9ac15b525c2922132a4aa9bb19
|
data/lib/mincer.rb
CHANGED
@@ -13,7 +13,7 @@ module Mincer
|
|
13
13
|
|
14
14
|
def to_json
|
15
15
|
if dump_supported?
|
16
|
-
result = Mincer.connection.
|
16
|
+
result = Mincer.connection.select_all(json_query).first['json']
|
17
17
|
return result unless @options[:singularize]
|
18
18
|
return (result[1..-2].presence || '{}') unless @options[:root]
|
19
19
|
(result.sub('[', '').sub(/(\])}$/, '}').presence || '{}')
|
data/lib/mincer/version.rb
CHANGED
@@ -15,7 +15,7 @@ describe ::Mincer::Processors::PgJsonDumper::Processor do
|
|
15
15
|
|
16
16
|
it 'dumps data via postgres' do
|
17
17
|
query = subject.new(ActiveRecordModel)
|
18
|
-
ActiveRecord::Base.connection.should_receive(:
|
18
|
+
ActiveRecord::Base.connection.should_receive(:select_all).and_call_original
|
19
19
|
json_string = query.to_json
|
20
20
|
json_string.should be_a(String)
|
21
21
|
json_hash = JSON.parse(json_string)
|
@@ -29,7 +29,7 @@ describe ::Mincer::Processors::PgJsonDumper::Processor do
|
|
29
29
|
context 'when root option is passed' do
|
30
30
|
it 'puts responce inside under root key' do
|
31
31
|
query = subject.new(ActiveRecordModel)
|
32
|
-
ActiveRecord::Base.connection.should_receive(:
|
32
|
+
ActiveRecord::Base.connection.should_receive(:select_all).and_call_original
|
33
33
|
json_string = query.to_json(root: 'items')
|
34
34
|
json_string.should be_a(String)
|
35
35
|
json_hash = JSON.parse(json_string)
|
@@ -56,7 +56,7 @@ describe ::Mincer::Processors::PgJsonDumper::Processor do
|
|
56
56
|
|
57
57
|
it 'dumps data via calling super' do
|
58
58
|
query = subject.new(ActiveRecordModel)
|
59
|
-
ActiveRecord::Base.connection.should_not_receive(:
|
59
|
+
ActiveRecord::Base.connection.should_not_receive(:select_all)
|
60
60
|
json_string = query.to_json
|
61
61
|
json_string.should be_nil
|
62
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mincer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Krasinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|