arql 0.1.8 → 0.1.9

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: f47b38ca9a139313e67c9e48f85955cba666d0afcdde220b79be871e0c45d5eb
4
- data.tar.gz: '04635866ef577ae689793c1c957b2f8822d900df1837f1fcf2667e0e8b6a504b'
3
+ metadata.gz: fc368945ff1a7d43a518b4e43007756ec037011fb18493f706ab83d27dcb037a
4
+ data.tar.gz: 07f259ca53861ea57a9e5f6a49fbf6fdfc69eed96dcadf4240757c6303c7fe5f
5
5
  SHA512:
6
- metadata.gz: 841b282b0fdf40efbb19b07f38e5db4cf84901db1f119d2ef3a859d18c4e7a4b01e5da771e710f8f46187fe09000c00fd2e72429aa6f065acedb96635c0a9fa8
7
- data.tar.gz: 8dee1cacc2abe2e4df4bed7cf1fb4a42e1cc9c0efa6d0057feaade821e53cb0f1abd2c345be1e7c370e010f3aed2cbd81af2bb07c0f2c28ad1deda10db7d3ff7
6
+ metadata.gz: 814a25787c74a23d44f3a812066924b521978047109944d574f4b7b5a13f7f3a916d02de0b09387e319937bb93f2801e3c8836cbc8650445168b4976c8265684
7
+ data.tar.gz: 886230ca5cbdb0f8aaf340b701a097063bf584f33d8b5bd14e956d859034439d54fa33dcdf567e04d4f22c54c923a042dd00260bdba5aef56f402ba295262ff6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.1.8)
4
+ arql (0.1.9)
5
5
  activerecord (~> 6.0.3)
6
6
  activesupport (~> 6.0.3)
7
7
  mysql2 (~> 0.5.3)
data/lib/arql.rb CHANGED
@@ -1,12 +1,8 @@
1
- require 'active_support/all'
2
- require 'active_record'
3
1
  require 'table_print'
4
2
  require "arql/version"
5
3
  require 'arql/id'
6
4
  require 'arql/multi_io'
7
5
  require 'arql/ext'
8
- require "arql/connection"
9
- require "arql/definition"
10
6
  require "arql/repl"
11
7
  require "arql/app"
12
8
  require "arql/cli"
data/lib/arql/app.rb CHANGED
@@ -14,6 +14,10 @@ module Arql
14
14
  end
15
15
 
16
16
  def initialize(options)
17
+ require 'active_support/all'
18
+ require 'active_record'
19
+ require "arql/connection"
20
+ require "arql/definition"
17
21
  @options = options
18
22
  Connection.open(connect_options)
19
23
  @definition = Definition.new(effective_config)
@@ -2,6 +2,16 @@ module Arql
2
2
  module Extension
3
3
  extend ActiveSupport::Concern
4
4
 
5
+ def t
6
+ puts Terminal::Table.new { |t|
7
+ t << ['Attribute Name', 'Attribute Value', 'SQL Type', 'Comment']
8
+ t << :separator
9
+ self.class.connection.columns(self.class.table_name).each do |column|
10
+ t << [column.name, read_attribute(column.name), column.sql_type, column.comment || '']
11
+ end
12
+ }
13
+ end
14
+
5
15
  def to_insert_sql
6
16
  self.class.to_insert_sql([self])
7
17
  end
data/lib/arql/ext.rb CHANGED
@@ -1 +1,3 @@
1
+ require 'arql/ext/object'
1
2
  require 'arql/ext/array'
3
+ require 'arql/ext/time'
@@ -0,0 +1,10 @@
1
+ class Object
2
+
3
+ def j
4
+ puts to_json
5
+ end
6
+
7
+ def jj
8
+ puts JSON.pretty_generate(JSON.parse(to_json))
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'active_support/core_ext/time/conversions'
2
+ require 'active_support/core_ext/object/json'
3
+
4
+ class Time
5
+ DATE_FORMATS ||= {}
6
+ DATE_FORMATS[:default] = '%Y-%m-%d %H:%M:%S'
7
+
8
+ def inspect
9
+ to_s
10
+ end
11
+
12
+ def as_json
13
+ to_s
14
+ end
15
+ end
data/lib/arql/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
@@ -180,6 +180,8 @@ files:
180
180
  - lib/arql/definition.rb
181
181
  - lib/arql/ext.rb
182
182
  - lib/arql/ext/array.rb
183
+ - lib/arql/ext/object.rb
184
+ - lib/arql/ext/time.rb
183
185
  - lib/arql/id.rb
184
186
  - lib/arql/multi_io.rb
185
187
  - lib/arql/repl.rb