parameter_substitution 1.1.0 → 1.3.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c67efeaefb3f001e0463995bc4fb9f3e74f355a0d90f1e88c9758098bdfcce
|
4
|
+
data.tar.gz: d40e06c430ee77c4c5955de0564f5dc3ec9cd728dd61904838110839b68d9553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc93edd7f1370d8bc70bb5e54194dfd0931616951e91528849c7589de68be4b8d0dcdd5a1e02c20f3f696e4038f01e05a73914d1909d74132c02c59aea8213dd
|
7
|
+
data.tar.gz: 5409c67d415ba25c74369151dc109c32c3077967e56d449aaaf43bb8ef5213bbff69d002265bb5ca0e916f141f7fa110736637fd7ed434a162f3ccadadd7c0bf
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ParameterSubstitution::Formatters::HexToBase64 < ParameterSubstitution::Formatters::Base
|
4
|
+
def self.description
|
5
|
+
"Converts hex encoded strings to base64 encoding"
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.format(value)
|
9
|
+
raise ArgumentError, "Bad non-hex input to hex_to_base64" if value !~ /^\h+$/
|
10
|
+
|
11
|
+
[[value].pack("H*")].pack("m0")
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ParameterSubstitution::Formatters::IfTruthy < ParameterSubstitution::Formatters::Base
|
4
|
+
TRUTHY_VALUES = [true, "true", "t", 1, "1", "on", "yes"].freeze
|
5
|
+
|
6
|
+
def self.description
|
7
|
+
"If the input is truthy (i.e. #{TRUTHY_VALUES.inspect}) then the input is replaced with the first argument. Otherwise, the input is replaced with the second argument."
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.has_parameters?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(value_if_true, value_if_false)
|
15
|
+
@value_if_true = value_if_true
|
16
|
+
@value_if_false = value_if_false
|
17
|
+
end
|
18
|
+
|
19
|
+
def format(value)
|
20
|
+
if TRUTHY_VALUES.include?(downcase_if_string(value))
|
21
|
+
@value_if_true
|
22
|
+
else
|
23
|
+
@value_if_false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
:private
|
28
|
+
|
29
|
+
def downcase_if_string(value)
|
30
|
+
if value.is_a?(String)
|
31
|
+
value.downcase
|
32
|
+
else
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
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: 1.1
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '7'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7'
|
@@ -110,7 +110,9 @@ files:
|
|
110
110
|
- lib/parameter_substitution/formatters/duration_as_time.rb
|
111
111
|
- lib/parameter_substitution/formatters/duration_grouped_by_description.rb
|
112
112
|
- lib/parameter_substitution/formatters/greater_than_value.rb
|
113
|
+
- lib/parameter_substitution/formatters/hex_to_base64.rb
|
113
114
|
- lib/parameter_substitution/formatters/if_nil.rb
|
115
|
+
- lib/parameter_substitution/formatters/if_truthy.rb
|
114
116
|
- lib/parameter_substitution/formatters/in_timezone.rb
|
115
117
|
- lib/parameter_substitution/formatters/json_parse.rb
|
116
118
|
- lib/parameter_substitution/formatters/left.rb
|
@@ -139,7 +141,7 @@ homepage: https://github.com/Invoca/parameter_substitution
|
|
139
141
|
licenses: []
|
140
142
|
metadata:
|
141
143
|
allowed_push_host: https://rubygems.org
|
142
|
-
post_install_message:
|
144
|
+
post_install_message:
|
143
145
|
rdoc_options: []
|
144
146
|
require_paths:
|
145
147
|
- lib
|
@@ -154,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
- !ruby/object:Gem::Version
|
155
157
|
version: '0'
|
156
158
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
159
|
+
rubygems_version: 3.1.6
|
160
|
+
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: Handles parsing an input strings with embedded substitution parameters and
|
161
163
|
replacing them with values from a provided mapping.
|