arql 0.3.22 → 0.3.24

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: f4178a1d360f59152ce5fac37b745a98a77ac744090114b6c9d70e89ec4dfe57
4
- data.tar.gz: 46520be1d1411eb164160d7e42d81012f5147272014556b6825e3cd122ed483c
3
+ metadata.gz: 7b5e4c176d948c9783bcd4262ff3382205543ad436e53f99c4f9dd0a03261871
4
+ data.tar.gz: f77eb6ab9e0aacfe0dbd421838d9f27df836200d31d4d66373f485c59fb8e9ce
5
5
  SHA512:
6
- metadata.gz: 377195d8ebfe1a1a1c5c0eac7d31533171bb95452eee33c2a74048b6d620e565d9ac804d821f1a9201ad803448717e20f50ad7e079065273e866e155535bae99
7
- data.tar.gz: 3c2a29b255032fc6efc7dc109a557e3e9dc2d8145854fa1d514d9b14551278424b95b81fd6f02d59cfff33a6fa66ae21e1d6cde1a7f408f9ba784189b13d7626
6
+ metadata.gz: f98696871ee66329b1545698b9b4583c43e84bbe35b52441905ee8d10bc969c2490e5f56ed47d119a3dce6189cff7abc9a9faeef18dc98549011d7efc1c0d56c
7
+ data.tar.gz: 33e9dc381d6e6f06319f20d9c8a804fcf644c3467b13ec3f2f4a306ba75be2af4987bd6a638920876f4ee507cb97fcd14800f6fdda00d1c427c504019c750a40
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.3.22)
4
+ arql (0.3.24)
5
5
  activerecord (>= 6.1.5, < 7.1.0)
6
6
  activesupport (>= 6.1.5, < 7.1.0)
7
7
  caxlsx (~> 3.3.0)
@@ -109,4 +109,8 @@ module Kernel
109
109
  end
110
110
  end
111
111
 
112
+ def parse_json(filename)
113
+ JSON.parse(IO.read(File.expand_path(filename)))
114
+ end
115
+
112
116
  end
@@ -10,4 +10,53 @@ class String
10
10
  def f
11
11
  expa
12
12
  end
13
+
14
+ def parse_excel
15
+ if File.file?(File.expand_path(self))
16
+ Kernel.parse_excel(File.expand_path(self))
17
+ else
18
+ raise "File not found: #{self}"
19
+ end
20
+ end
21
+
22
+ def parse_csv
23
+ if File.file?(File.expand_path(self))
24
+ Kernel.parse_csv(File.expand_path(self))
25
+ else
26
+ raise "File not found: #{self}"
27
+ end
28
+ end
29
+
30
+ def parse_json
31
+ if File.file?(File.expand_path(self))
32
+ Kernel.parse_json(File.expand_path(self))
33
+ else
34
+ raise "File not found: #{self}"
35
+ end
36
+ end
37
+
38
+ def parse
39
+ if File.file?(File.expand_path(self))
40
+ if self =~ /\.xlsx?$/i
41
+ parse_excel
42
+ elsif self =~ /\.csv$/i
43
+ parse_csv
44
+ elsif self =~ /\.json$/i
45
+ parse_json
46
+ else
47
+ raise "File type not supported: #{self}"
48
+ end
49
+ else
50
+ raise "File not found: #{self}"
51
+ end
52
+ end
53
+
54
+ def vd
55
+ if File.file?(File.expand_path(self))
56
+ system "vd '#{File.expand_path(self)}'"
57
+ print "\033[5 q"
58
+ else
59
+ raise "File not found: #{self}"
60
+ end
61
+ end
13
62
  end
data/lib/arql/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.3.22"
2
+ VERSION = "0.3.24"
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.22
4
+ version: 0.3.24
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-04-17 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2