arql 0.3.24 → 0.3.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b5e4c176d948c9783bcd4262ff3382205543ad436e53f99c4f9dd0a03261871
4
- data.tar.gz: f77eb6ab9e0aacfe0dbd421838d9f27df836200d31d4d66373f485c59fb8e9ce
3
+ metadata.gz: 75374eb39a5a3d9884f9b37c1287e3fbb6d27d94d24728b9ac9091e594a9f8d2
4
+ data.tar.gz: 10894affb8ee03218a63abf310945a854759b7001e577a489f18e775aeb1b2a5
5
5
  SHA512:
6
- metadata.gz: f98696871ee66329b1545698b9b4583c43e84bbe35b52441905ee8d10bc969c2490e5f56ed47d119a3dce6189cff7abc9a9faeef18dc98549011d7efc1c0d56c
7
- data.tar.gz: 33e9dc381d6e6f06319f20d9c8a804fcf644c3467b13ec3f2f4a306ba75be2af4987bd6a638920876f4ee507cb97fcd14800f6fdda00d1c427c504019c750a40
6
+ metadata.gz: 20eeb742b3df786f5ee33dc7d8814dd08e9271311eb71d8c12bb8df978c853d8ce1eb7cc42aa4bedb94b280e04a011ff6bc1da36970dc69cde6a261ad843adfc
7
+ data.tar.gz: a4fc6d58b9be5c4843259e9eb118f2a813d3c36bcb8af6be732120b8b0088e86fa336ba6fcd67d9ab6bfdba6dc2e6b0295df8021453e35713bfce0c5144cf89e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.3.24)
4
+ arql (0.3.25)
5
5
  activerecord (>= 6.1.5, < 7.1.0)
6
6
  activesupport (>= 6.1.5, < 7.1.0)
7
7
  caxlsx (~> 3.3.0)
@@ -13,11 +13,13 @@ PATH
13
13
  pry-byebug (~> 3.10.1)
14
14
  pry-doc (>= 1.4.0)
15
15
  rainbow (~> 3.0.0)
16
- ransack (>= 3.2.1)
16
+ ransack (~> 3.2.1)
17
17
  roo (~> 2.9.0)
18
- sqlite3 (~> 1.5.4)
18
+ sqlite3 (~> 1.6.8)
19
19
  table_print (~> 1.5.6)
20
20
  terminal-table (~> 1.8.0)
21
+ tty-tree (~> 0.4.0)
22
+ youplot (~> 0.4.5)
21
23
 
22
24
  GEM
23
25
  remote: https://rubygems.org/
@@ -42,6 +44,7 @@ GEM
42
44
  composite_primary_keys (14.0.4)
43
45
  activerecord (~> 7.0.2)
44
46
  concurrent-ruby (1.1.10)
47
+ enumerable-statistics (2.0.7)
45
48
  gem-release (2.2.2)
46
49
  htmlentities (4.3.4)
47
50
  i18n (1.12.0)
@@ -81,20 +84,24 @@ GEM
81
84
  nokogiri (~> 1)
82
85
  rubyzip (>= 1.3.0, < 3.0.0)
83
86
  rubyzip (2.3.2)
84
- sqlite3 (1.5.4)
85
- mini_portile2 (~> 2.8.0)
87
+ sqlite3 (1.6.8-x86_64-darwin)
86
88
  table_print (1.5.7)
87
89
  terminal-table (1.8.0)
88
90
  unicode-display_width (~> 1.1, >= 1.1.1)
91
+ tty-tree (0.4.0)
89
92
  tzinfo (2.0.5)
90
93
  concurrent-ruby (~> 1.0)
91
94
  unicode-display_width (1.8.0)
95
+ unicode_plot (0.0.5)
96
+ enumerable-statistics (>= 2.0.1)
92
97
  webrick (1.7.0)
93
98
  yard (0.9.28)
94
99
  webrick (~> 1.7.0)
100
+ youplot (0.4.5)
101
+ unicode_plot (>= 0.0.5)
95
102
 
96
103
  PLATFORMS
97
- ruby
104
+ x86_64-darwin-22
98
105
 
99
106
  DEPENDENCIES
100
107
  arql!
data/arql.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_dependency 'mysql2', '~> 0.5.4'
27
27
  # spec.add_dependency 'pg', '>= 0.18', '< 2.0'
28
- spec.add_dependency 'sqlite3', '~> 1.5.4'
28
+ spec.add_dependency 'sqlite3', '~> 1.6.8'
29
29
  # spec.add_dependency 'activerecord-sqlserver-adapter'
30
30
  # spec.add_dependency 'activerecord-oracle_enhanced-adapter'
31
31
  spec.add_dependency 'activerecord', '>= 6.1.5', '< 7.1.0'
@@ -41,6 +41,8 @@ Gem::Specification.new do |spec|
41
41
  spec.add_dependency 'table_print', '~> 1.5.6'
42
42
  spec.add_dependency 'roo', '~> 2.9.0'
43
43
  spec.add_dependency 'caxlsx', '~> 3.3.0'
44
- spec.add_dependency 'ransack', '>= 3.2.1'
44
+ spec.add_dependency 'ransack', '~> 3.2.1'
45
+ spec.add_dependency 'youplot', '~> 0.4.5'
46
+ spec.add_dependency 'tty-tree', '~> 0.4.0'
45
47
  spec.add_development_dependency "gem-release", "~> 2.2.2"
46
48
  end
@@ -1,4 +1,5 @@
1
1
  require 'arql/vd'
2
+ require 'youplot'
2
3
 
3
4
  class Array
4
5
  def to_insert_sql(batch_size=500)
@@ -176,4 +177,47 @@ class Array
176
177
  end
177
178
  {size: size, file: File.expand_path(filename)}
178
179
  end
180
+
181
+ %i[bar barplot countplot hist histo line lineplot lines lineplots scatter density box boxplot].each do |type|
182
+ define_method(type) do |*args|
183
+ plot_backend = YouPlot::Backends::UnicodePlot
184
+ params = Struct.new(:title, :width, :height, :border, :margin, :padding, :color, :xlabel,
185
+ :ylabel, :labels, :symbol, :xscale, :nbins, :closed, :canvas, :xlim, :ylim, :grid, :name) do
186
+ def to_hc
187
+ {}
188
+ end
189
+ end.new
190
+ fmt = 'xyy'
191
+ raw_data = map do |e|
192
+ if e.is_a?(Array)
193
+ e
194
+ else
195
+ [e]
196
+ end
197
+ end
198
+ transposed = Array.new(raw_data.map(&:length).max) { |i| raw_data.map { |e| e[i] } }
199
+ data = Struct.new(:headers, :series).new(nil, transposed)
200
+ plot = case type
201
+ when :bar, :barplot
202
+ plot_backend.barplot(data, params, fmt)
203
+ when :countplot
204
+ plot_backend.barplot(data, params, count: true, reverse: false)
205
+ when :hist, :histo
206
+ plot_backend.histogram(data, params)
207
+ when :line, :lineplot
208
+ plot_backend.line(data, params, fmt)
209
+ when :lines, :lineplots
210
+ plot_backend.lines(data, params, fmt)
211
+ when :scatter
212
+ plot_backend.scatter(data, params, fmt)
213
+ when :density
214
+ plot_backend.density(data, params, fmt)
215
+ when :box, :boxplot
216
+ plot_backend.boxplot(data, params)
217
+ else
218
+ raise "unrecognized plot_type: #{type}"
219
+ end
220
+ plot.render(STDOUT)
221
+ end
222
+ end
179
223
  end
data/lib/arql/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.3.24"
2
+ VERSION = "0.3.25"
3
3
  end
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.3.24
4
+ version: 0.3.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.4
33
+ version: 1.6.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.5.4
40
+ version: 1.6.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -236,16 +236,44 @@ dependencies:
236
236
  name: ransack
237
237
  requirement: !ruby/object:Gem::Requirement
238
238
  requirements:
239
- - - ">="
239
+ - - "~>"
240
240
  - !ruby/object:Gem::Version
241
241
  version: 3.2.1
242
242
  type: :runtime
243
243
  prerelease: false
244
244
  version_requirements: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - ">="
246
+ - - "~>"
247
247
  - !ruby/object:Gem::Version
248
248
  version: 3.2.1
249
+ - !ruby/object:Gem::Dependency
250
+ name: youplot
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - "~>"
254
+ - !ruby/object:Gem::Version
255
+ version: 0.4.5
256
+ type: :runtime
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: 0.4.5
263
+ - !ruby/object:Gem::Dependency
264
+ name: tty-tree
265
+ requirement: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - "~>"
268
+ - !ruby/object:Gem::Version
269
+ version: 0.4.0
270
+ type: :runtime
271
+ prerelease: false
272
+ version_requirements: !ruby/object:Gem::Requirement
273
+ requirements:
274
+ - - "~>"
275
+ - !ruby/object:Gem::Version
276
+ version: 0.4.0
249
277
  - !ruby/object:Gem::Dependency
250
278
  name: gem-release
251
279
  requirement: !ruby/object:Gem::Requirement