semian 0.13.1 → 0.13.2

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: 78f1c9a991cd16ae1da354babc364364cf1aac75f07b1fb3d694f75c94f33411
4
- data.tar.gz: 51585c1ccf8aa6f02c45b1da9da58753e91ce45a92f99c3880c5fb46c6b82aa5
3
+ metadata.gz: 540294c5a9ecdfdcbafcdc1485afd1314a94fd869501bc6795ee327606d3e799
4
+ data.tar.gz: 5855959232d25ea3c2da1f7ca7096c18afb15161ac8116e8f1ece9792fd456e4
5
5
  SHA512:
6
- metadata.gz: 6b8f18a662e05dbedb5dec96ed1c740a40d1a644a098d01e0b82440aa6a877b9f3d67611cb38293699fb2a19bd4cf7aa9b0fa02c03babaa9063856d8cfabcd25
7
- data.tar.gz: 32546169e572cacd1cb85b63dd8b01164ba4eb15858394c9163d9de3d2ffdb258418f2dac7ebcb51e7ad8bd6ff592973c81f7758e8085a855b31011ce13c47e2
6
+ metadata.gz: c7549cd0c6dc515733612fcd7b200c23467104c5616ff9501b65a554712e0449d07d8d2d479b45962cffb87c8e6cd2fc82d695a1d9f399a5724b3b4c241c59a8
7
+ data.tar.gz: cf31ff975016b22e101db10813d73ab8288584657c9f7319ef222790dcd052d3ab45caedcca2639140d2199be87d1f790f0c82edf918d388c669f9be68b467f2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Unreleased
2
2
 
3
+ # v0.13.2
4
+
5
+ * Fix: Update AbstractAdapter patch to accomodate recent Rails changes. (#364)
6
+
3
7
  # v0.13.1
4
8
 
5
9
  * Fix: Raise `Redis::OutOfMemoryError` for messages that match `OOM command not allowed when used memory > 'maxmemory'` rather than checking `start_with?("OOM ")`. (#367)
data/lib/semian/rails.rb CHANGED
@@ -2,14 +2,35 @@
2
2
 
3
3
  require "active_record/connection_adapters/abstract_adapter"
4
4
 
5
- module ActiveRecord
6
- module ConnectionAdapters
7
- class AbstractAdapter
8
- def semian_resource
9
- # support for https://github.com/rails/rails/commit/d86fd6415c0dfce6fadb77e74696cf728e5eb76b
10
- connection = instance_variable_defined?(:@raw_connection) ? @raw_connection : @connection
11
- connection.semian_resource
5
+ module Semian
6
+ module Rails
7
+ def semian_resource
8
+ @semian_resource ||= client_connection.semian_resource
9
+ end
10
+
11
+ def reconnect
12
+ @semian_resource = nil
13
+ super
14
+ end
15
+
16
+ private
17
+
18
+ # client_connection is an instance of a Mysql2::Client
19
+ #
20
+ # The conditionals here support multiple Rails versions.
21
+ # - valid_raw_connection is for 7.1.x and above
22
+ # - @raw_connection is for 7.0.x
23
+ # - @connection is for versions below 6.1.x and below
24
+ def client_connection
25
+ if respond_to?(:valid_raw_connection)
26
+ valid_raw_connection
27
+ elsif instance_variable_defined?(:@raw_connection)
28
+ @raw_connection
29
+ else
30
+ @connection
12
31
  end
13
32
  end
14
33
  end
15
34
  end
35
+
36
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Semian::Rails)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Semian
4
- VERSION = "0.13.1"
4
+ VERSION = "0.13.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Francis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-08-16 00:00:00.000000000 Z
13
+ date: 2022-08-19 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |2
16
16
  A Ruby C extention that is used to control access to shared resources