arql 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/arql/ext/array.rb +20 -0
- data/lib/arql/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: '0939ceb0070d909cdcad849a8f0d58c205ed95a3143595e3debfa9313fac2466'
|
4
|
+
data.tar.gz: d53563cd4c57b46b35ecc7eb3749dfddeb62d53ce671571ea49ad5572ab01d1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf5bfe566b9908251e3204fdd8fa08e30a7aa40cd0df722f7f9aa4f0092536964b2b244ed20ca1b289e10ea97df7d1c44a765b24ef1943f6850f17d670c5010
|
7
|
+
data.tar.gz: 444ed7209ec62243a8ca3791ede58096853ab3af37fac1016c29944b2b609788d35d2edb5b3feb9c8955d08e45cc5cbc520f1f2325735361526d53dd4d98c718
|
data/Gemfile.lock
CHANGED
data/lib/arql/ext/array.rb
CHANGED
@@ -38,6 +38,26 @@ class Array
|
|
38
38
|
t.body << e.attributes.values_at(*attrs.map(&:to_s))
|
39
39
|
end
|
40
40
|
}
|
41
|
+
elsif (attrs.present? || options.present? && options[:except]) && present? && first.is_a?(Hash)
|
42
|
+
column_names = first.keys
|
43
|
+
attrs = attrs.flat_map { |e| e.is_a?(Regexp) ? column_names.grep(e) : e }.uniq
|
44
|
+
if options.present? && options[:except]
|
45
|
+
attrs = column_names if attrs.empty?
|
46
|
+
if options[:except].is_a?(Regexp)
|
47
|
+
attrs.reject! { |e| e =~ options[:except] }
|
48
|
+
else
|
49
|
+
attrs -= [options[:except]].flatten
|
50
|
+
end
|
51
|
+
end
|
52
|
+
# if options[:compact]
|
53
|
+
# attrs = attrs.select { |e| any { |r| r.attributes[e.to_s]&.present? } }
|
54
|
+
# end
|
55
|
+
tbl = Arql::Table.new { |t|
|
56
|
+
t.headers = attrs
|
57
|
+
each do |e|
|
58
|
+
t.body << e.values_at(*attrs.map(&:to_s))
|
59
|
+
end
|
60
|
+
}
|
41
61
|
else
|
42
62
|
values = v(**options)
|
43
63
|
tbl = Arql::Table.new { |t|
|
data/lib/arql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Xiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|