arql 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50c397f035d89506f745002163459930acf16862c71aba29f61e3843da9fefef
4
- data.tar.gz: b4dce80cde7add1ec3aafbb54e9d12736bc5e0d661f0f28aebcaf66c3bbc98a3
3
+ metadata.gz: 675fcf2d77da426d416fbd40ebb7cbe916939f66a1e7d1a9300e2f10d889395e
4
+ data.tar.gz: 4b474cdf29f419a59e7978994a510480d3f396d67255965a5379d66cd493c104
5
5
  SHA512:
6
- metadata.gz: c60d3e7cd72361b59239c26967079e9c9baa0f28ff16caec7b20074d3a08636670e41afc7290fea95bfe00bc8ca4e78586aa89a996974c37364dc99c1e8c4855
7
- data.tar.gz: 64f66abb0e4494b3f2b49b6972af3aab5a5e030f5b9ee9f51e074136a01eeeb2b8647aacad7c8d7501f5ea1c195d9100b93040a634c4db4e552d23d141df046c
6
+ metadata.gz: 0fe878856e68bea3e5d4edb6a2d2e959da73ca7acbdfb0e14a9d7e713158a7fab468debd0e300627aeecbf54143f2296058579cbce4c69f280fa64f64117672d
7
+ data.tar.gz: 3a35d6b710fb75ad5a9b0bc7f515a56c67b84bdf0cd73d9b509a5e2fc5f4627b556fe1554732046ba3f97cfcab5415eba86bd49809348c767af858d733cdb2a9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.1.5)
4
+ arql (0.1.6)
5
5
  activerecord (~> 6.0.3)
6
6
  activesupport (~> 6.0.3)
7
7
  mysql2 (~> 0.5.3)
data/lib/arql/app.rb CHANGED
@@ -16,7 +16,7 @@ module Arql
16
16
  def initialize(options)
17
17
  @options = options
18
18
  Connection.open(connect_options)
19
- @definition = Definition.new
19
+ @definition = Definition.new(effective_config)
20
20
  end
21
21
 
22
22
  def connect_options
@@ -34,7 +34,7 @@ module Arql
34
34
  end
35
35
  end
36
36
 
37
- def initialize
37
+ def initialize(options)
38
38
  @@models = []
39
39
  ActiveRecord::Base.connection.tap do |conn|
40
40
  conn.tables.each do |table_name|
@@ -48,6 +48,17 @@ module Arql
48
48
  self.table_name = table_name
49
49
  self.inheritance_column = nil
50
50
  self.default_timezone = :local
51
+ if options[:created_at].present?
52
+ define_singleton_method :timestamp_attributes_for_create do
53
+ options[:created_at]
54
+ end
55
+ end
56
+
57
+ if options[:updated_at].present?
58
+ define_singleton_method :timestamp_attributes_for_update do
59
+ options[:updated_at]
60
+ end
61
+ end
51
62
  end.tap do |clazz|
52
63
  Object.const_set(const_name, clazz).tap do |const|
53
64
  const_name.gsub(/[a-z]*/, '').tap do |abbr|
data/lib/arql/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang