parameter_substitution 0.2.0 → 0.3.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parameter_substitution.rb +16 -5
  3. metadata +7 -132
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d80f82074e131750e1afb35a41059527cd77ee21
4
- data.tar.gz: b1705ba2642c31f7636d6aeb2faaced383783a97
3
+ metadata.gz: 6cc065caf5495a6eb293189475b549b2143a422f
4
+ data.tar.gz: cb4cc3f82eb1ecd6163ad7cbf432cc2454f0e497
5
5
  SHA512:
6
- metadata.gz: d64da8dee80e1e5e98f3f117e5d5479f851cca7f3fef49963e6c31e3e84de3519bc9ed74d60687439d995f03a2006f3c4522aa35b5a316fa1bbef5a71d18b972
7
- data.tar.gz: c7e225edc595863abb9ddf89efff397b5df1288d6b1576d5afd76c6661f42f7131157103f6179960a5108e6d4ce4fec09d4164dbda836f603a16b102626fe285
6
+ metadata.gz: dead877cadef6706c2f0bfc833ce677c45c816e786a33b3ca9a32e4b9a3f12e9c473dfda8bef88c4dbb296b97b80d3811327eaa5ee61d1c6b65ffbc014840aa4
7
+ data.tar.gz: 713b75455392a1dcd45326d8a1d6143b4de25177e5036040e50e3404a29107f5058109c2bf04878bb29cb517358d5ea4774703654489542ecc9af9f94be30c83
@@ -51,9 +51,9 @@ class ParameterSubstitution
51
51
 
52
52
  expression = parse_expression(context)
53
53
  expression.validate
54
- [expression.evaluate, expression.warnings]
54
+ [expression.evaluate, expression.warnings, expression.parameter_and_method_warnings]
55
55
  rescue ParameterSubstitution::ParseError => ex
56
- [context.input, ex.message]
56
+ [context.input, ex.message, expression&.parameter_and_method_warnings]
57
57
  rescue => ex
58
58
  raise SubstitutionError, "Error occurred while parameter substitution: #{ex.message}"
59
59
  end
@@ -64,13 +64,24 @@ class ParameterSubstitution
64
64
  ParameterSubstitution.config = config
65
65
  end
66
66
 
67
- def find_tokens(input)
68
- context = ParameterSubstitution::Context.new(input: input, mapping: [])
69
- parse_expression(context).substitution_parameter_names
67
+ def find_tokens(string_with_tokens, mapping: {})
68
+ parse_expression(context_from_string(string_with_tokens, mapping)).substitution_parameter_names
69
+ end
70
+
71
+ def find_formatters(string_with_tokens, mapping: {})
72
+ parse_expression(context_from_string(string_with_tokens, mapping)).method_names
73
+ end
74
+
75
+ def find_warnings(string_with_tokens, mapping: {})
76
+ parse_expression(context_from_string(string_with_tokens, mapping)).parameter_and_method_warnings || []
70
77
  end
71
78
 
72
79
  private
73
80
 
81
+ def context_from_string(string_with_tokens, mapping)
82
+ ParameterSubstitution::Context.new(input: string_with_tokens, mapping: mapping)
83
+ end
84
+
74
85
  def parse_expression(context)
75
86
  cst = ParameterSubstitution::Parser.new(
76
87
  parameter_start: context.parameter_start,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parameter_substitution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Smith
@@ -9,134 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-08 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: activesupport
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '4.0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '4.0'
28
- - !ruby/object:Gem::Dependency
29
- name: builder
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: bump
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: 0.6.1
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: 0.6.1
56
- - !ruby/object:Gem::Dependency
57
- name: bundler
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '1.12'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '1.12'
70
- - !ruby/object:Gem::Dependency
71
- name: hobo_support
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: invoca-utils
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: 0.0.3
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: 0.0.3
98
- - !ruby/object:Gem::Dependency
99
- name: parslet
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '1.8'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '1.8'
112
- - !ruby/object:Gem::Dependency
113
- name: rake
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: '10.0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: '10.0'
126
- - !ruby/object:Gem::Dependency
127
- name: rspec
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '3.0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '3.0'
12
+ date: 2020-04-24 00:00:00.000000000 Z
13
+ dependencies: []
140
14
  description: The substitution can be formatted using a syntax that looks like method
141
15
  calls
142
16
  email:
@@ -150,7 +24,8 @@ files:
150
24
  - lib/parameter_substitution.rb
151
25
  homepage: https://github.com/Invoca/parameter_substitution
152
26
  licenses: []
153
- metadata: {}
27
+ metadata:
28
+ allowed_push_host: https://rubygems.org
154
29
  post_install_message:
155
30
  rdoc_options: []
156
31
  require_paths:
@@ -162,9 +37,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
37
  version: '0'
163
38
  required_rubygems_version: !ruby/object:Gem::Requirement
164
39
  requirements:
165
- - - ">="
40
+ - - ">"
166
41
  - !ruby/object:Gem::Version
167
- version: '0'
42
+ version: 1.3.1
168
43
  requirements: []
169
44
  rubyforge_project:
170
45
  rubygems_version: 2.6.13