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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 054d44665ba78d1751047ba4ebc0eb34a37cc312fe36e7cf238c7412c505f3bc
4
- data.tar.gz: 0b4fb1dd12313e82bd489defaed84eadf9e1919726503e9235ce3a2ed582d820
3
+ metadata.gz: 19379206907c5abb7a46bc56a035d93ab2ccc384de6ce516080604019aecaf9d
4
+ data.tar.gz: c5a88a56de993fe7ff0e65ccd5a7d07572a3696ddca2b2787b63e8ff460c1a6f
5
5
  SHA512:
6
- metadata.gz: 4f30c3a11c0e2931740670a8bc4030a1714630f4eda0d511e4a49a69de276f1793825e1a7de6b01d510309e09225d51f64bdb24d83755a037809342d39366ba1
7
- data.tar.gz: 8be879b0911d23e5c3db84bf0e686b6a29ef77c9adecb3be8058b4094d231ed0c79876fe638c5aeb21b9184fbb95dc63e2dab151f231d918f661a11e4a78f22f
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
@@ -45,16 +45,30 @@ module PM
45
45
 
46
46
  private
47
47
 
48
- # A parameter named like a public Object method (`hash`, `display`, ...)
49
- # would otherwise never reach method_missing.
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 if Metadata::PROTECTED_METHODS.include?(sym)
54
- next unless Object.public_method_defined?(sym)
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
- define_singleton_method(sym) { @params[key] }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PM
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer