arql 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arql/app.rb +2 -1
- data/lib/arql/definition.rb +8 -2
- data/lib/arql/ext/object.rb +4 -0
- data/lib/arql/repl.rb +2 -2
- 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: 8e8fc504dce79a217260e4141983ed9688ea6b26bbb559293a91989f954a14ce
|
4
|
+
data.tar.gz: '0826d7a38e803b7298afa8dce9f48e17246af86f6994f534e2168575f8081c86'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff3be0324cd12c584969fc66d6a6859c9e41c2cae6f3c721fb2cce663cd53eee986f584ad3f00bf6c0ce38c29ad9a0c5623ff244262b3165119a11fdc1e8842d
|
7
|
+
data.tar.gz: ff54d6fa435f403ecdbe53ff0acf8db12c4fc1fa79ef2809badeab7dcef79fbdd28d008458af871025ff90e00a0629a205cc6ef6bd95a2d853e2eceadbd27837
|
data/lib/arql/app.rb
CHANGED
@@ -4,7 +4,7 @@ module Arql
|
|
4
4
|
class App
|
5
5
|
|
6
6
|
class << self
|
7
|
-
attr_accessor :log_io, :env, :prompt
|
7
|
+
attr_accessor :log_io, :env, :prompt, :instance
|
8
8
|
|
9
9
|
def config
|
10
10
|
@@effective_config
|
@@ -29,6 +29,7 @@ module Arql
|
|
29
29
|
Connection.open(connect_options)
|
30
30
|
@definition = Definition.new(effective_config)
|
31
31
|
load_initializer!
|
32
|
+
App.instance = self
|
32
33
|
end
|
33
34
|
|
34
35
|
def connect_options
|
data/lib/arql/definition.rb
CHANGED
@@ -124,6 +124,8 @@ module Arql
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
127
|
+
|
128
|
+
App.instance&.load_initializer!
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
@@ -176,14 +178,18 @@ module Arql
|
|
176
178
|
end
|
177
179
|
|
178
180
|
::ActiveRecord::Relation.class_eval do
|
179
|
-
def t
|
180
|
-
records.t
|
181
|
+
def t(*attrs)
|
182
|
+
records.t(*attrs)
|
181
183
|
end
|
182
184
|
|
183
185
|
def v
|
184
186
|
records.v
|
185
187
|
end
|
186
188
|
|
189
|
+
def a
|
190
|
+
to_a
|
191
|
+
end
|
192
|
+
|
187
193
|
def write_csv(filename, *fields, **options)
|
188
194
|
records.write_csv(filename, *fields, **options)
|
189
195
|
end
|
data/lib/arql/ext/object.rb
CHANGED
data/lib/arql/repl.rb
CHANGED
@@ -25,7 +25,7 @@ module Arql
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def prompt
|
28
|
-
[proc do |obj, nest_level,
|
28
|
+
[proc do |obj, nest_level, pry_instance|
|
29
29
|
if obj == main_object && nest_level == 0
|
30
30
|
nest_level_prompt = ''
|
31
31
|
else
|
@@ -35,7 +35,7 @@ module Arql
|
|
35
35
|
"(#{obj}:#{nest_level})"
|
36
36
|
end
|
37
37
|
end
|
38
|
-
"%s#{Rainbow('@').green}%s#{nest_level_prompt} %s " % [Rainbow('ARQL').red, Rainbow(App.prompt).yellow, Rainbow('❯').green]
|
38
|
+
"%s#{Rainbow('@').green}%s#{nest_level_prompt} [%d] %s " % [Rainbow('ARQL').red, Rainbow(App.prompt).yellow, pry_instance.input_ring.count, Rainbow('❯').green]
|
39
39
|
end]
|
40
40
|
end
|
41
41
|
end
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Xiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|