yiffspace-core 0.2.0 → 0.2.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: 616274421a5c76dd24f3280528dba48846a7d8ffdbf2b6b77a8a9bc6ba243f5e
4
- data.tar.gz: 49ef59c885784dc479dcc475a4bf55e24bf208a53e9a4288354a68072b2cfd1b
3
+ metadata.gz: dcc7debaf3de27ae727e1ff742fd67eda285f06cf098d623968298bf4ef5f32c
4
+ data.tar.gz: b17224bbb3249295b7f08132bf66c0c45770d638f5918909611e8d175d383afc
5
5
  SHA512:
6
- metadata.gz: ae0ca898066aeb4781fc565f168189a42601476610b234bdf3fb3431a97dc275e2163a19db67fff2b10718b549bead50a715bcd721635f461d11028ae8b931d4
7
- data.tar.gz: 7b358ed2a0c766ded8b197596eb768bcdfdc062d1f523f19bb271eda4259f484ce2aeaa7c48192600b1c11d44b91136772eae108a3a9ca594bb445305d475b70
6
+ metadata.gz: 6a84fcebd3d24a033798cd6f02d1e69aa8cdf0679bafea7f2987ff66cb849b858d18367db016d4bf23a93e01975e1bbc5b373eb186c354594bcdf458d43a7b87
7
+ data.tar.gz: da3e8a6557800d1c1259f6bf998fc8b52b79f8c2e4848729166a3667f16d1d28acb21f8661481071b716dc06bcf5f9b7e8287d4e8d6386cd9f5a381f13bf4b93
data/CHANGELOG.md CHANGED
@@ -32,6 +32,25 @@
32
32
  - The dummy test app no longer needs Postgres - only the fixes table's
33
33
  `nulls_not_distinct` index required it, and that lives in `yiffspace-fixers`
34
34
  now. Back to plain sqlite3, `docker-compose.yml` removed.
35
+ - Fixed `YiffSpace::Utils::Helpers`/`Routes` (`Helpers`/`Routes` under
36
+ `yiffspace-include`) dropping keyword arguments: their `method_missing` used
37
+ a bare `*, &` splat, which isn't `ruby2_keywords`-aware, so a call like
38
+ `h.some_helper(post, tags: tags)` arrived with the `tags:` hash flattened
39
+ into a positional argument instead of a keyword - silently landing in
40
+ whatever parameter came next rather than raising. Both now use `...` to
41
+ forward positional, keyword, and block arguments correctly.
42
+ - `YiffSpace::Utils::Helpers` (`Helpers`) now also makes the app's route
43
+ `_path`/`_url` helpers available *inside* the helper methods it proxies to,
44
+ not just to callers going through it directly - a helper that itself calls
45
+ `some_path(...)` (with no receiver) now works the same way it would from a
46
+ real view, instead of raising `NoMethodError`.
47
+ - Fixed `parallel_find_each` exhausting the connection pool: records run on
48
+ concurrent-ruby's shared `:io` pool, whose threads never exit, so any plain
49
+ `connection` call inside the block leased a connection to that thread for
50
+ good. Once enough threads held one, every other record waited out the pool
51
+ timeout and raised `ActiveRecord::ConnectionTimeoutError`. Each record now
52
+ runs inside `with_connection(prevent_permanent_checkout: true)`, which
53
+ returns the connection when the block finishes.
35
54
 
36
55
  ## 0.1.0
37
56
 
@@ -6,12 +6,16 @@ module YiffSpace
6
6
  extend(ActiveSupport::Concern)
7
7
 
8
8
  class_methods do
9
- def parallel_find_each(**, &)
9
+ def parallel_find_each(**, &block)
10
10
  # XXX We may deadlock if a transaction is open; do a non-parallel each.
11
- return find_each(&) if connection.transaction_open?
11
+ return find_each(&block) if connection.transaction_open?
12
12
 
13
13
  find_in_batches(error_on_ignore: true, **) do |batch|
14
- batch.parallel_each(&)
14
+ # The pool threads are shared and never finish, so a connection leased on one (any plain
15
+ # `connection` call) would be held forever, starving the rest. Return it after each record
16
+ batch.parallel_each do |record|
17
+ connection_pool.with_connection(prevent_permanent_checkout: true) { block.call(record) }
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module YiffSpace
4
4
  module Core
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
@@ -10,16 +10,40 @@ module YiffSpace
10
10
  # `h.some_helper`), including ones marked private in their helper module - private only
11
11
  # restricts calling with an explicit receiver, and normal view rendering (which invokes
12
12
  # helpers without one) isn't affected either way.
13
- def method_missing(name, *, &)
14
- helpers = YiffSpace.config.application_controller_class.helpers
15
- return helpers.send(name, *, &) if helpers.respond_to?(name, true)
13
+ def method_missing(name, ...)
14
+ helpers = target
15
+ return helpers.send(name, ...) if helpers.respond_to?(name, true)
16
16
 
17
17
  super
18
18
  end
19
19
 
20
20
  def respond_to_missing?(name, include_private = false)
21
- YiffSpace.config.application_controller_class.helpers.respond_to?(name, true) || super
21
+ target.respond_to?(name, true) || super
22
+ end
23
+
24
+ # ApplicationController.helpers behaves like a view for registered helper modules, but
25
+ # (unlike an actual view) doesn't include the app's route url_helpers - so a helper method
26
+ # invoked through this proxy couldn't call `some_path`/`some_url` itself. Extend the shared
27
+ # proxy once so route helpers are available from inside helper methods too, not just to
28
+ # callers going through this module directly.
29
+ #
30
+ # `extend`ing the generated url_helpers module only grants the path/url helper methods
31
+ # themselves - they're written to call `url_options`/`_routes`/`optimize_routes_generation?`
32
+ # on whatever they're called on, and the module only defines those three on its own
33
+ # singleton class (so it works standalone), not as instance methods `extend` would carry
34
+ # over. Delegate them by hand so the extended methods have what they need to run.
35
+ def target
36
+ helpers = YiffSpace.config.application_controller_class.helpers
37
+ url_helpers = Rails.application.routes.url_helpers
38
+ unless helpers.is_a?(url_helpers)
39
+ helpers.define_singleton_method(:url_options) { url_helpers.url_options }
40
+ helpers.define_singleton_method(:_routes) { url_helpers._routes }
41
+ helpers.define_singleton_method(:optimize_routes_generation?) { url_helpers.optimize_routes_generation? }
42
+ helpers.extend(url_helpers)
43
+ end
44
+ helpers
22
45
  end
46
+ private_class_method(:target)
23
47
  end
24
48
  end
25
49
  end
@@ -13,9 +13,9 @@ module YiffSpace
13
13
  module Routes
14
14
  module_function
15
15
 
16
- def method_missing(name, *, &)
16
+ def method_missing(name, ...)
17
17
  url_helpers = Rails.application.routes.url_helpers
18
- return url_helpers.public_send(name, *, &) if url_helpers.respond_to?(name)
18
+ return url_helpers.public_send(name, ...) if url_helpers.respond_to?(name)
19
19
 
20
20
  super
21
21
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yiffspace-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan_DMC
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-09-04 00:00:00.000000000 Z
10
+ date: 2026-10-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: abbrev