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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 243555de4d65c13fb1bff8927ac5cf07ce92e385d7b14bc24d5ecb6b56c91eea
4
- data.tar.gz: 821402d1717fab422655ba4ed895d7fe0e901f4039c6837548f0e921294a8b66
3
+ metadata.gz: 8e8fc504dce79a217260e4141983ed9688ea6b26bbb559293a91989f954a14ce
4
+ data.tar.gz: '0826d7a38e803b7298afa8dce9f48e17246af86f6994f534e2168575f8081c86'
5
5
  SHA512:
6
- metadata.gz: aa17e8c66c687b5aa6fa6aa7d36c753c4841d08c33b2be525809adf2ee2d2fba683010126b2e0af3ccf3552ce215146355285795174db27a6ea98f8e9c405834
7
- data.tar.gz: 961a643cf21cbf86522acd362616e6256ab9ab1a9d85b87beeb2be4f0b5e28743ac49cd0571b376912ff61e7ab0e05c9a77c6275db41acf056e26b37bd1bef8b
6
+ metadata.gz: ff3be0324cd12c584969fc66d6a6859c9e41c2cae6f3c721fb2cce663cd53eee986f584ad3f00bf6c0ce38c29ad9a0c5623ff244262b3165119a11fdc1e8842d
7
+ data.tar.gz: ff54d6fa435f403ecdbe53ff0acf8db12c4fc1fa79ef2809badeab7dcef79fbdd28d008458af871025ff90e00a0629a205cc6ef6bd95a2d853e2eceadbd27837
@@ -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
@@ -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
@@ -15,4 +15,8 @@ class Object
15
15
  def jjp
16
16
  puts jj
17
17
  end
18
+
19
+ def a
20
+ [self]
21
+ end
18
22
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.2.1
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-08-31 00:00:00.000000000 Z
11
+ date: 2020-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2