parameter_substitution 1.1.0.pre.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd79e76be437773c0f7529978b5e7ad05a5dd19a8f8ed0c6d160dc031bf20d5b
|
4
|
+
data.tar.gz: 7f73b99656b011c09f447c5ef99540a37c04826c0a978a4e7a7b1ce619c25779
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46d22a6a652538cd04bd3778541e2ce64c526686a7fc4194da45913bb3ffa1cd930eb871ffa48044728936bd4c79e7a28536c725dcf5a6309ee9e4789028345d
|
7
|
+
data.tar.gz: 0e64f0595ca1685bd181e3a5976597e51688f96b7c9831eaf10485e44428e4884425b2d23d9205cd0e83c6fcb8cd6a3e309330cd2e17b9954245315a92e08944
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parameter_substitution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.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: 2020-05-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: builder
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,7 +111,6 @@ files:
|
|
105
111
|
- lib/parameter_substitution/formatters/duration_grouped_by_description.rb
|
106
112
|
- lib/parameter_substitution/formatters/greater_than_value.rb
|
107
113
|
- lib/parameter_substitution/formatters/if_nil.rb
|
108
|
-
- lib/parameter_substitution/formatters/if_truthy.rb
|
109
114
|
- lib/parameter_substitution/formatters/in_timezone.rb
|
110
115
|
- lib/parameter_substitution/formatters/json_parse.rb
|
111
116
|
- lib/parameter_substitution/formatters/left.rb
|
@@ -145,9 +150,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
150
|
version: '0'
|
146
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
152
|
requirements:
|
148
|
-
- - "
|
153
|
+
- - ">="
|
149
154
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
155
|
+
version: '0'
|
151
156
|
requirements: []
|
152
157
|
rubygems_version: 3.0.3
|
153
158
|
signing_key:
|
@@ -1,36 +0,0 @@
|
|
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
|