solid_callback 3.0.0 → 3.1.0

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: fff26382f82c48f8ffdc91046c65e8f33dba192b17463a00a44a720325b4561f
4
- data.tar.gz: 428d700ce0867f8be0ee11e9219b5ca7ac2da3ba0dddbc3d006e92a9c6ad4f8b
3
+ metadata.gz: 8d4868400ada59602777596c75942cdb942d5be9e44ad383d766706ce1bc14b0
4
+ data.tar.gz: 8131d95e2f3c04527216b38c4a030bfcb9e623e6b1912e344fa7fa592237aee0
5
5
  SHA512:
6
- metadata.gz: 755e70d9004ad6cfc06bd23286864f56ebf2c4d43ffe969751ad9eb52cb29d848c26113f78e4d07ddb52ab1b96e4946fdb21ec003037e09f3161a53abacb4872
7
- data.tar.gz: 338864ffd6ac8ee32f9b4e5576ff80a7d8c31e59ae420ccabf3600996766c6aa5b9c2c060d3e9446a46bbe1b123b1bcd414a44fee2c0a57aea846c0bfe8723ad
6
+ metadata.gz: 11fd8d6357fe2b71c683443f03bb0db6eb45a7467cf048ea5a0a30b06aee63f4a75329cbc39220524828cf596b871c1bdcba781b264bc646f7fa64899cb8818c
7
+ data.tar.gz: 7373f5b5c012a02d8cd6c4dbde06bf25e5bac6ad35591f4e3043245a03dd4b0043f5c201ced775864838d56426b6cd76af56b483996f8320677ba3b2da9b96cd
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/solid_callback.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/solid_callback)
4
4
  [![Test](https://github.com/gklsan/solid_callback/actions/workflows/ruby.yml/badge.svg)](https://github.com/gklsan/solid_callback/actions/workflows/ruby.yml)
5
- [![Downloads](https://img.shields.io/gem/dt/simple_http_service.svg)](https://badge.fury.io/rb/simple_http_service)
5
+ [![Downloads](https://img.shields.io/gem/dt/solid_callback.svg)](https://badge.fury.io/rb/solid_callback)
6
6
  [![Github forks](https://img.shields.io/github/forks/gklsan/solid_callback.svg)](https://github.com/gklsan/solid_callback/network)
7
7
  [![Github stars](https://img.shields.io/github/stars/gklsan/solid_callback.svg)](https://github.com/gklsan/solid_callback/stargazers)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -18,6 +18,10 @@ SolidCallback adds powerful method interception capabilities to your Ruby classe
18
18
  - 🔒 **Thread-safe**: Safely use in concurrent applications
19
19
  - 📝 **Conditional execution**: Run callbacks only when specific conditions are met
20
20
 
21
+ ## Requirements
22
+
23
+ - Ruby >= 3.3.0
24
+
21
25
  ## Installation
22
26
 
23
27
  Add this line to your application's Gemfile:
@@ -138,15 +142,13 @@ before_call :notify_admin, if: -> { Rails.env.production? }
138
142
 
139
143
  ### Skipping Callbacks
140
144
 
141
- Skip callbacks for specific methods:
145
+ Use `except:` to exclude specific methods from a callback:
142
146
 
143
147
  ```ruby
144
148
  class ApiService
145
149
  include SolidCallback
146
150
 
147
- before_call :rate_limit
148
-
149
- skip_callbacks_for :health_check
151
+ before_call :rate_limit, except: [:health_check]
150
152
 
151
153
  def get_data
152
154
  # Implementation...
@@ -159,6 +161,10 @@ class ApiService
159
161
  end
160
162
  ```
161
163
 
164
+ > **Note:** `skip_callbacks_for` is also available on the class, but it currently only
165
+ > records the given method names — it does not yet suppress callback execution. Prefer
166
+ > `except:` (as above) until that's wired up.
167
+
162
168
  ## Callback Options
163
169
 
164
170
  Each callback method accepts the following options:
@@ -172,12 +178,24 @@ Each callback method accepts the following options:
172
178
 
173
179
  ## How It Works
174
180
 
175
- Callbacker uses Ruby's metaprogramming to wrap your methods with callback functionality:
176
-
177
- 1. When included, it extends your class with callback registration methods
178
- 2. When a callback is registered, it stores the configuration
179
- 3. When a method is defined, it wraps the method with callback handling code
180
- 4. When the method is called, it executes the callbacks in the proper order
181
+ SolidCallback uses Ruby's metaprogramming to wrap your methods with callback functionality:
182
+
183
+ 1. `include SolidCallback` extends your class with the callback registration API and
184
+ hooks into `method_added` so newly defined methods can be wrapped automatically.
185
+ 2. `before_call`, `after_call`, and `around_call` just store the callback configuration
186
+ (method name, `only`/`except`/`if`/`unless`) on the class they don't need to run
187
+ before the target method is defined.
188
+ 3. Each time a **public** instance method is defined, it's aliased to
189
+ `_solid_callback_original_<method>` and replaced with a wrapper that runs the
190
+ applicable `before` callbacks, then the `around` chain (which ultimately calls the
191
+ original method), then the applicable `after` callbacks. Private/protected methods
192
+ are left untouched.
193
+ 4. Applicability (`only`, `except`, `if`, `unless`) is evaluated per call, against the
194
+ actual instance, so the same callback can behave differently per invocation.
195
+ 5. `around_call` callbacks are nested in registration order (the first one registered is
196
+ outermost) and must `yield` to continue the chain, much like Rack middleware.
197
+ 6. If a method needs wrapping outside the normal `method_added` flow, call
198
+ `wrap_methods(:method_name, ...)` explicitly.
181
199
 
182
200
  ## 📚 Use Cases
183
201
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidCallback
4
- VERSION = "3.0.0"
4
+ VERSION = "3.1.0"
5
5
  end
data/mise.toml CHANGED
@@ -1,2 +1,2 @@
1
1
  [tools]
2
- ruby = "4"
2
+ ruby = "3.4.2"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_callback
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gokul (gklsan)
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-07-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -124,14 +124,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: 4.0.1
127
+ version: 3.3.0
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 4.0.3
134
+ rubygems_version: 3.6.6
135
135
  specification_version: 4
136
136
  summary: SolidCallback adds powerful method interception capabilities to your Ruby
137
137
  classes with near-zero overhead. Clean, flexible, and unobtrusive.