parameter_substitution 2.1.0 → 3.0.0.pre.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: 4e7c5ff0d63f2eef878d72b3179e5d7974fb02c4f4fd35eccfe06b867cbc0a3a
4
- data.tar.gz: 7390779f6c5f4a44e753ac06a9a2ac6ea9d191f1c59b5782784b6a3492e17dd8
3
+ metadata.gz: b7d5937f29714849ed0f6dcb964e0976a010cf106cf0c7a3abc8fc431d93b770
4
+ data.tar.gz: b5410f60e594f40f6becd805a050b0e385ad58f71e049a421b6a7c07f76d8542
5
5
  SHA512:
6
- metadata.gz: 27bd0d07ae2549d0e872eb5e8ce13a40218f1fdd721d57b7beedb0b3cef23016a8e52fd1c14ad65ccfcec68c4a47a06a05da6e17778af08ae62083b96ca7b6db
7
- data.tar.gz: 82dae913ff94b303bde20a947865056242228b955b4e5c3a53d73c602a29843a57032441ea2279113a3ca716e2634b6268cb89b2f7d88523c16bd60a36fa1913
6
+ metadata.gz: 385b533cc23ad5c51c9e3e8de2aa4898617b375d1692523cd4f1c34df0a20256cb074e73fb7d5c7303b18540797164c58e2fca212392b35a74d685439c31c014
7
+ data.tar.gz: 8b4f90595113426f82ca45c691056f0fcb602bdad90df6f0e15e7996edb0d2f60b3f09fc432a0defd023ef5a8f5ce048e6482b792340f29a1e0daa395c8afc46
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ParameterSubstitution
4
- VERSION = "2.1.0"
4
+ VERSION = "3.0.0-0"
5
5
  end
@@ -63,27 +63,35 @@ class ParameterSubstitution
63
63
  ParameterSubstitution.config = config
64
64
  end
65
65
 
66
- def find_tokens(string_with_tokens, mapping: {}, parameter_start: "<", parameter_end: ">")
67
- parse_expression(context_from_string(string_with_tokens, mapping, parameter_start: parameter_start, parameter_end: parameter_end)).substitution_parameter_names
66
+ def find_tokens(string_with_tokens, mapping: {}, context_overrides: nil)
67
+ context = build_context(string_with_tokens, mapping, context_overrides)
68
+ parse_expression(context).substitution_parameter_names
68
69
  end
69
70
 
70
- def find_formatters(string_with_tokens, mapping: {}, parameter_start: "<", parameter_end: ">")
71
- parse_expression(context_from_string(string_with_tokens, mapping, parameter_start: parameter_start, parameter_end: parameter_end)).method_names
71
+ def find_formatters(string_with_tokens, mapping: {}, context_overrides: nil)
72
+ context = build_context(string_with_tokens, mapping, context_overrides)
73
+ parse_expression(context).method_names
72
74
  end
73
75
 
74
- def find_warnings(string_with_tokens, mapping: {}, parameter_start: "<", parameter_end: ">")
75
- parse_expression(context_from_string(string_with_tokens, mapping, parameter_start: parameter_start, parameter_end: parameter_end)).parameter_and_method_warnings || []
76
+ def find_warnings(string_with_tokens, mapping: {}, context_overrides: nil)
77
+ context = build_context(string_with_tokens, mapping, context_overrides)
78
+ parse_expression(context).parameter_and_method_warnings || []
76
79
  end
77
80
 
78
81
  private
79
82
 
80
- def context_from_string(string_with_tokens, mapping, parameter_start: "<", parameter_end: ">")
81
- ParameterSubstitution::Context.new(
83
+ # Build context with optional overrides
84
+ # @param [String] string_with_tokens The input string containing tokens
85
+ # @param [Hash] mapping The mapping of parameters to values
86
+ # @param [Hash, nil] context_overrides Optional overrides for context attributes
87
+ # @return [ParameterSubstitution::Context] The constructed context
88
+ def build_context(string_with_tokens, mapping, context_overrides)
89
+ base_options = {
82
90
  input: string_with_tokens,
83
- mapping:,
84
- parameter_start:,
85
- parameter_end:
86
- )
91
+ mapping: mapping
92
+ }
93
+
94
+ ParameterSubstitution::Context.new(**base_options.merge(context_overrides || {}))
87
95
  end
88
96
 
89
97
  def parse_expression(context)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parameter_substitution
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0.pre.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca Development
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-06 00:00:00.000000000 Z
11
+ date: 2025-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport