prompt_manager 1.1.0 → 1.2.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/pm/render_scope.rb +19 -5
- data/lib/pm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19379206907c5abb7a46bc56a035d93ab2ccc384de6ce516080604019aecaf9d
|
|
4
|
+
data.tar.gz: c5a88a56de993fe7ff0e65ccd5a7d07572a3696ddca2b2787b63e8ff460c1a6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dba13493af0167fd8f9a5f75ee5259b2731ad3fd849fd6ec3427fdf25389c2a9e51b888280238069e231e2a4e7aaf84ba93bbc6eaf87e38667fa41a67ce86285
|
|
7
|
+
data.tar.gz: 405110550b15a0d180aa76ef537a76169a042d373dc94f3fc8c19f9dfd4beedff86fec1dcd97abcea446d12ba5ff233673606989863e893928083e84b49f21c2
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.2.0] - 2026-11-01
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Parameters named after private Kernel methods.** A parameter called
|
|
12
|
+
`format`, `test`, `system` or another private `Kernel` method rendered the
|
|
13
|
+
method instead of the value (`<%= format %>` raised `ArgumentError`).
|
|
14
|
+
Parameters now shadow private as well as public `Object` methods. Called
|
|
15
|
+
with arguments or a block (`format('%d', 1)`), the name is still the
|
|
16
|
+
method. `binding` is never shadowed.
|
|
17
|
+
|
|
7
18
|
## [1.1.0] - 2026-11-01
|
|
8
19
|
|
|
9
20
|
A hardening release. Shell expansion can no longer be hijacked by its own
|
data/lib/pm/render_scope.rb
CHANGED
|
@@ -45,16 +45,30 @@ module PM
|
|
|
45
45
|
|
|
46
46
|
private
|
|
47
47
|
|
|
48
|
-
#
|
|
49
|
-
|
|
48
|
+
# Never shadowed: erb_binding calls `binding`.
|
|
49
|
+
UNSHADOWED = %i[binding].freeze
|
|
50
|
+
|
|
51
|
+
# A parameter named like an Object method -- public (`hash`, `display`)
|
|
52
|
+
# or private Kernel (`format`, `test`, `system`) -- would otherwise never
|
|
53
|
+
# reach method_missing. Called bare it is the parameter; called with
|
|
54
|
+
# arguments or a block it is still the method.
|
|
50
55
|
def shadow_object_methods
|
|
51
56
|
@params.each_key do |key|
|
|
52
57
|
sym = key.to_sym
|
|
53
|
-
next
|
|
54
|
-
|
|
58
|
+
next unless shadowable?(sym)
|
|
59
|
+
|
|
60
|
+
define_singleton_method(sym) do |*args, **kwargs, &block|
|
|
61
|
+
next @params[key] if args.empty? && kwargs.empty? && block.nil?
|
|
55
62
|
|
|
56
|
-
|
|
63
|
+
super(*args, **kwargs, &block)
|
|
64
|
+
end
|
|
57
65
|
end
|
|
58
66
|
end
|
|
67
|
+
|
|
68
|
+
def shadowable?(sym)
|
|
69
|
+
return false if Metadata::PROTECTED_METHODS.include?(sym) || UNSHADOWED.include?(sym)
|
|
70
|
+
|
|
71
|
+
Object.public_method_defined?(sym) || Object.private_method_defined?(sym)
|
|
72
|
+
end
|
|
59
73
|
end
|
|
60
74
|
end
|
data/lib/pm/version.rb
CHANGED