like_query 0.0.8 → 0.0.9
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/like_query/collect.rb +4 -3
- data/lib/like_query/model_extensions.rb +4 -4
- data/lib/like_query/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09331b69e73a5710ea602d9f20c26a11453589480b8be7130bb678a430c13f17'
|
4
|
+
data.tar.gz: 82eb9cb8c04f0c3d0d6fa7bccd22fde4cf9468a3aec31f533f2ce8d2fb9d0765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '090626d9d0b0afe7879c6a7053e9ab3e87fd7e3faa797015ab47bbc258c41ee19bc2666fda4bb0bfacb8c563e871e9f75c2e959275836d0233955f3cd7fdbdad'
|
7
|
+
data.tar.gz: c1835c63c13d9b09d084b34b6b7ae24db6cf890317166e130e13daf56f8f8baabe6d4ae49bc9f36b94798276caa07853fbca6eee0f58978bca143dfecd7a76d1
|
data/lib/like_query/collect.rb
CHANGED
@@ -24,7 +24,7 @@ module LikeQuery
|
|
24
24
|
@schemes[model.to_s] = schema_to_hash(schema)
|
25
25
|
end
|
26
26
|
|
27
|
-
def collect(output_schema = nil, limit: nil, parent: nil, image: nil, &block)
|
27
|
+
def collect(output_schema = nil, limit: nil, parent: nil, image: nil, url: nil, &block)
|
28
28
|
|
29
29
|
_limit = (limit ? (@limit && @limit < limit ? @limit : limit) : @limit)
|
30
30
|
return false if @length >= _limit
|
@@ -76,7 +76,7 @@ module LikeQuery
|
|
76
76
|
@data[parent_key][:children] ||= []
|
77
77
|
@data[parent_key][:children].push(r)
|
78
78
|
else
|
79
|
-
r = record_to_hash(rec, schema, image)
|
79
|
+
r = record_to_hash(rec, schema, image, url: url)
|
80
80
|
@data["#{rec.class}#{rec.id}"] = r
|
81
81
|
end
|
82
82
|
c = (@image ? 1 : 0) + r[:values].to_a.length
|
@@ -109,7 +109,7 @@ module LikeQuery
|
|
109
109
|
|
110
110
|
private
|
111
111
|
|
112
|
-
def record_to_hash(record, schema, image, parent = nil)
|
112
|
+
def record_to_hash(record, schema, image, parent = nil, url: nil)
|
113
113
|
r = {}
|
114
114
|
schema[:values].each do |k|
|
115
115
|
v = get_column_value(record, k)
|
@@ -126,6 +126,7 @@ module LikeQuery
|
|
126
126
|
r[:model] = record.class.to_s
|
127
127
|
end
|
128
128
|
r[:image] = record.send(image) if image
|
129
|
+
r[:url] = url.yield(record) if url
|
129
130
|
r
|
130
131
|
end
|
131
132
|
|
@@ -53,15 +53,15 @@ module LikeQuery
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def generate_hash(output_schema = nil, limit: 50, image: nil)
|
56
|
+
def generate_hash(output_schema = nil, limit: 50, image: nil, url: nil)
|
57
57
|
c = LikeQuery::Collect.new(limit)
|
58
|
-
c.collect(output_schema, limit: limit, image: image) { all }
|
58
|
+
c.collect(output_schema, limit: limit, image: image, url: url) { all }
|
59
59
|
c.generate_hash
|
60
60
|
end
|
61
61
|
|
62
|
-
def generate_json(output_schema = nil, limit: 50, image: nil)
|
62
|
+
def generate_json(output_schema = nil, limit: 50, image: nil, url: nil)
|
63
63
|
c = LikeQuery::Collect.new(limit)
|
64
|
-
c.collect(output_schema, limit: limit, image: image) { all }
|
64
|
+
c.collect(output_schema, limit: limit, image: image, url: url) { all }
|
65
65
|
c.generate_json
|
66
66
|
end
|
67
67
|
|
data/lib/like_query/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: like_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|