super_callbacks 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +34 -0
- data/.ruby-version +1 -1
- data/README.md +8 -6
- data/lib/super_callbacks/instance_methods.rb +1 -1
- data/lib/super_callbacks/version.rb +3 -3
- data/super_callbacks.gemspec +30 -30
- metadata +21 -19
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1ff61ccd4535f1b5298367e7416de1ccda840dc014d248c4db0b40526bc59f5
|
4
|
+
data.tar.gz: a4858b6a58610680948fcf6468e3517c42892c1f5f318be4a6352c4baa7d9739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd637d0d3a36e2a9cf459a36224d5cfd07add1cdf7b1ef93e5958f77dd0171356f198731453d1adf90ca357703b27a12e01970254f7d9e76d898b5c36c3b1dd6
|
7
|
+
data.tar.gz: 2968508f9fea1e44689014f69d840e09de03fec2c80a396ec0a631be8bebfd7f8cb1c005e7343b72c0cc18ea5835da0cf6a0c68f34c86dbc1b524c9d20c836cc
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['3.0.0', '3.1.6', '3.2.6', '3.3.6']
|
17
|
+
steps:
|
18
|
+
- name: Checkout code
|
19
|
+
uses: actions/checkout@v3
|
20
|
+
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
cache: bundler
|
26
|
+
|
27
|
+
- name: Install Bundler 2.5.23
|
28
|
+
run: gem install bundler -v 2.5.23
|
29
|
+
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
|
33
|
+
- name: Run tests
|
34
|
+
run: bundle exec rake spec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.2.6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SuperCallbacks
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CI](https://github.com/jrpolidario/super_callbacks/actions/workflows/ci.yml/badge.svg)](https://github.com/jrpolidario/super_callbacks/actions/workflows/ci.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/super_callbacks.svg)](https://badge.fury.io/rb/super_callbacks)
|
5
5
|
|
6
6
|
* Allows `before` and `after` callbacks to any Class.
|
@@ -8,7 +8,9 @@
|
|
8
8
|
* Supports both class and instance level callbacks
|
9
9
|
* Supports conditional callbacks
|
10
10
|
* Supports inherited callbacks; hence named "Super", get it? :D haha!
|
11
|
+
|
11
12
|
---
|
13
|
+
|
12
14
|
* Focuses on performance and flexibility as intended primarily for game development, and event-driven apps
|
13
15
|
* Standalone; no other gem dependencies
|
14
16
|
* `super_callbacks` is the upgraded version of my other repo [`dragonruby_callbacks`](https://github.com/jrpolidario/dragonruby_callbacks)
|
@@ -144,7 +146,7 @@ foo.bar
|
|
144
146
|
# => 'bar!'
|
145
147
|
```
|
146
148
|
|
147
|
-
*Notice above multiple callbacks are supported, and that they are called in
|
149
|
+
*Notice above multiple callbacks are supported, and that they are called in first-come-first-served order.*
|
148
150
|
|
149
151
|
*Above uses `before`, but works similarly with `after`*
|
150
152
|
|
@@ -401,13 +403,13 @@ foo.bar = 1 # bar is not changed from 1 to 1
|
|
401
403
|
# => 1
|
402
404
|
```
|
403
405
|
|
404
|
-
*Notice above on the second time `foo.bar = 1` is called, "new value" was no longer "puts", because `@bar` didn't change from 1 to 1. You can only use `instance_variables_before_change`, `instance_variable_before_change` and `instance_variable_changed?` inside the
|
406
|
+
*Notice above on the second time `foo.bar = 1` is called, "new value" was no longer "puts", because `@bar` didn't change from 1 to 1. You can only use `instance_variables_before_change`, `instance_variable_before_change` and `instance_variable_changed?` inside the `SuperCallbacks` cycle; otherwise you will get a `"You cannot call this method outside the SuperCallbacks cycle"` error.*
|
405
407
|
|
406
408
|
*Above uses `after!`, but works similarly with `before!`*
|
407
409
|
|
408
410
|
## TODOs
|
409
411
|
* when the need already arises, implement `around` (If you have ideas or want to help this part, please feel free to fork or send me a message! :)
|
410
|
-
*
|
412
|
+
* Without changing the DSL, try to find a better solution than current one to fix [this bug](https://github.com/jrpolidario/super_callbacks/issues/1). As it required me to write a bit of overhead code via `InheritancePrepender` module.
|
411
413
|
|
412
414
|
## Development
|
413
415
|
|
@@ -425,8 +427,8 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
425
427
|
|
426
428
|
## Changelog
|
427
429
|
|
428
|
-
* [1.3.
|
429
|
-
* [Fixed difficult bug: callbacks not in order when method defined in subclass and not in superclass when using inherited callbacks](https://github.com/jrpolidario/super_callbacks/issues/1
|
430
|
+
* [1.3.1 (2019-08-15)](https://github.com/jrpolidario/super_callbacks/commit/dcc71648d9be06074280c936add04b6b3f921e10)
|
431
|
+
* [Fixed difficult bug: callbacks not in order when method defined in subclass and not in superclass when using inherited callbacks](https://github.com/jrpolidario/super_callbacks/issues/1)
|
430
432
|
* Refactored a lot of code, and added slight overhead. I'm satisfied at the moment until I could find the best solution.
|
431
433
|
* 1.2.0 (2019-08-15)
|
432
434
|
* [Fixed / Supported Nested "Dirty" Changes on nested callbacks for idempotency (Thread-safe)](https://github.com/jrpolidario/super_callbacks/blob/4e9284e1c6150c6d5da536766d51b4e635bb819d/spec/super_callbacks_spec.rb#L487)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module SuperCallbacks
|
2
|
-
# The methods defined here will be available "
|
2
|
+
# The methods defined here will be available "instance" methods for any class where SuperCallbacks is included
|
3
3
|
module InstanceMethods
|
4
4
|
def run_before_callbacks(method_name, *args)
|
5
5
|
class_before_callbacks = self.class.instance_variable_get(:@before_callbacks) || {}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module SuperCallbacks
|
2
|
-
VERSION = '1.3.
|
3
|
-
end
|
1
|
+
module SuperCallbacks
|
2
|
+
VERSION = '1.3.2'
|
3
|
+
end
|
data/super_callbacks.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
lib = File.expand_path('lib', __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'super_callbacks/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'super_callbacks'
|
7
|
-
spec.version = SuperCallbacks::VERSION
|
8
|
-
spec.authors = ['Jules Roman B. Polidario']
|
9
|
-
spec.email = ['jules@topfloor.ie']
|
10
|
-
|
11
|
-
spec.summary = 'Allows `before` and `after` callbacks to any Class. Supports dirty checking of instance variables changes, class and instance level callbacks, conditional callbacks, and inherited callbacks.'
|
12
|
-
spec.description = 'Allows `before` and `after` callbacks to any Class. Supports dirty checking of instance variables changes, class and instance level callbacks, conditional callbacks, and inherited callbacks. Focuses on performance and flexibility as intended primarily for game development, and event-driven apps.'
|
13
|
-
spec.homepage = 'https://github.com/jrpolidario/super_callbacks'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
spec.bindir = 'exe'
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ['lib']
|
22
|
-
|
23
|
-
spec.required_ruby_version = '
|
24
|
-
|
25
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
-
spec.add_development_dependency 'pry', '~> 0.
|
29
|
-
spec.add_development_dependency 'pry-nav', '~> 0.
|
30
|
-
end
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'super_callbacks/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'super_callbacks'
|
7
|
+
spec.version = SuperCallbacks::VERSION
|
8
|
+
spec.authors = ['Jules Roman B. Polidario']
|
9
|
+
spec.email = ['jules@topfloor.ie']
|
10
|
+
|
11
|
+
spec.summary = 'Allows `before` and `after` callbacks to any Class. Supports dirty checking of instance variables changes, class and instance level callbacks, conditional callbacks, and inherited callbacks.'
|
12
|
+
spec.description = 'Allows `before` and `after` callbacks to any Class. Supports dirty checking of instance variables changes, class and instance level callbacks, conditional callbacks, and inherited callbacks. Focuses on performance and flexibility as intended primarily for game development, and event-driven apps.'
|
13
|
+
spec.homepage = 'https://github.com/jrpolidario/super_callbacks'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.required_ruby_version = '>= 2.0', '< 4.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.5.23'
|
26
|
+
spec.add_development_dependency 'rake', '~> 13.2.1'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.14.2'
|
29
|
+
spec.add_development_dependency 'pry-nav', '~> 1.0.0'
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_callbacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jules Roman B. Polidario
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.5.23
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.5.23
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 13.2.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 13.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.4.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.14.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.14.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry-nav
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 1.0.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 1.0.0
|
83
83
|
description: Allows `before` and `after` callbacks to any Class. Supports dirty checking
|
84
84
|
of instance variables changes, class and instance level callbacks, conditional callbacks,
|
85
85
|
and inherited callbacks. Focuses on performance and flexibility as intended primarily
|
@@ -90,10 +90,10 @@ executables: []
|
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
+
- ".github/workflows/ci.yml"
|
93
94
|
- ".gitignore"
|
94
95
|
- ".rspec"
|
95
96
|
- ".ruby-version"
|
96
|
-
- ".travis.yml"
|
97
97
|
- Gemfile
|
98
98
|
- LICENSE.txt
|
99
99
|
- README.md
|
@@ -112,24 +112,26 @@ homepage: https://github.com/jrpolidario/super_callbacks
|
|
112
112
|
licenses:
|
113
113
|
- MIT
|
114
114
|
metadata: {}
|
115
|
-
post_install_message:
|
115
|
+
post_install_message:
|
116
116
|
rdoc_options: []
|
117
117
|
require_paths:
|
118
118
|
- lib
|
119
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '2.0'
|
124
|
+
- - "<"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '4.0'
|
124
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
128
|
requirements:
|
126
129
|
- - ">="
|
127
130
|
- !ruby/object:Gem::Version
|
128
131
|
version: '0'
|
129
132
|
requirements: []
|
130
|
-
|
131
|
-
|
132
|
-
signing_key:
|
133
|
+
rubygems_version: 3.4.19
|
134
|
+
signing_key:
|
133
135
|
specification_version: 4
|
134
136
|
summary: Allows `before` and `after` callbacks to any Class. Supports dirty checking
|
135
137
|
of instance variables changes, class and instance level callbacks, conditional callbacks,
|