hoardable 0.19.5 → 0.19.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: a6f31a9da610dfb039bb478370d50c10de00ddd92a3b7d7fed56ba3b31c6efda
4
- data.tar.gz: 56b31a0137f6c141d0a0d0892967e4fe6ce2677a60a3b30cd9bfdb780e771d6f
3
+ metadata.gz: f0ada29a358bfb5f0fb228452d76724b72019885731a90e6c74f66d1088f797a
4
+ data.tar.gz: 6f9477217d44169cbcfdc0e5b0ee619ec1a44b043f396e7b7107100cc5de9e5a
5
5
  SHA512:
6
- metadata.gz: 570e74d13169c08cb6caa0f478264588ffbbc7eed1701911dcaf22254f7799753df34df87b2ee44a323ef065249e1d97bdb12e4142cff0a5921118f8aa5b9739
7
- data.tar.gz: 9ae737967fdb74a154b4f215f84c195db8f608c6d156906c6283965be135fcbc8e9a33d426ee96623ee3e1c9003916159cdf7c1da6fe71bbabba4fa55c7c1ed2
6
+ metadata.gz: 469b867e63023ce187d3aec39c44f9710792c9999eb2bd45289d64d7899057c6f119cd51677ade6b916d8ab7364f20eaa6fad5ed0bd10438c6393e81730e3ec9
7
+ data.tar.gz: f7fe21278b35d8730d90e4c3a201778554666afa971999ada34fbc5c482eb64f3324cb4009e7afa6ac3696926f942e2f2c19099798dd71c0f7dc324156b5180d
@@ -28,8 +28,11 @@ module Hoardable
28
28
  end
29
29
 
30
30
  def find_or_initialize_hoardable_event_uuid
31
- Thread.current[:hoardable_event_uuid] ||= Thread.current[:contextual_event_uuid] ||
32
- SecureRandom.uuid
31
+ contextual_event_uuid = Thread.current[:contextual_event_uuid]
32
+
33
+ return contextual_event_uuid unless contextual_event_uuid.nil?
34
+
35
+ Thread.current[:hoardable_event_uuid] ||= SecureRandom.uuid
33
36
  end
34
37
 
35
38
  def initialize_version_attributes(operation)
@@ -9,6 +9,9 @@ module Hoardable
9
9
  extend ActiveSupport::Concern
10
10
 
11
11
  class_methods do
12
+ # Allows setting a custom table name for the +version+ model.
13
+ attr_accessor :version_table_name
14
+
12
15
  # If called with a hash, this will set the model-level +Hoardable+ configuration variables. If
13
16
  # called without an argument it will return the computed +Hoardable+ configuration considering
14
17
  # both model-level and global values.
@@ -43,7 +46,7 @@ module Hoardable
43
46
  end
44
47
 
45
48
  private def hoardable_current_config_key
46
- "hoardable_#{name}_config".to_sym
49
+ :"hoardable_#{name}_config"
47
50
  end
48
51
  end
49
52
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hoardable
4
- VERSION = "0.19.5"
4
+ VERSION = "0.19.6"
5
5
  end
@@ -27,12 +27,13 @@ module Hoardable
27
27
  # disable STI on versions tables
28
28
  self.inheritance_column = :_
29
29
 
30
- self.table_name = "#{table_name.singularize}#{VERSION_TABLE_SUFFIX}"
30
+ self.table_name =
31
+ superclass.version_table_name || "#{table_name.singularize}#{VERSION_TABLE_SUFFIX}"
31
32
 
32
33
  alias_method :readonly?, :persisted?
33
34
 
34
35
  %i[operation event_uuid during].each do |symbol|
35
- define_method("hoardable_#{symbol}") { public_send("_#{symbol}") }
36
+ define_method(:"hoardable_#{symbol}") { public_send(:"_#{symbol}") }
36
37
  end
37
38
 
38
39
  # @!scope class
@@ -105,7 +106,7 @@ module Hoardable
105
106
  transaction do
106
107
  insert_untrashed_source.tap do |untrashed|
107
108
  untrashed
108
- .send("hoardable_client")
109
+ .send(:hoardable_client)
109
110
  .insert_hoardable_version("insert") do
110
111
  untrashed.instance_variable_set(:@hoardable_version, self)
111
112
  untrashed.run_callbacks(:untrashed)
@@ -114,7 +115,7 @@ module Hoardable
114
115
  end
115
116
  end
116
117
 
117
- DATA_KEYS.each { |key| define_method("hoardable_#{key}") { _data&.dig(key.to_s) } }
118
+ DATA_KEYS.each { |key| define_method(:"hoardable_#{key}") { _data&.dig(key.to_s) } }
118
119
 
119
120
  # Returns the +ActiveRecord+
120
121
  # {https://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changes changes} that
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoardable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.5
4
+ version: 0.19.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - justin talbott