-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing name_pattern -> pattern (#1976)
Merged PR #1976.
- Loading branch information
1 parent
a5a9042
commit 786eab1
Showing
12 changed files
with
42 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<% object.all_user_properties.select(&:pattern).each do |p| -%> | ||
<% | ||
prop_names = p.pattern.scan(/{{([a-z]*)}}/).flatten | ||
props = object.all_user_properties.select { |p| prop_names.include?(p.name) } | ||
-%> | ||
def <%= p.name.underscore -%>_pattern(name, module): | ||
if name is None: | ||
return | ||
|
||
regex = r<%= lines(build_url(regex_url(p.pattern))) -%> | ||
|
||
if not re.match(regex, name): | ||
<% if props.any? { |p| p.is_a?(Api::Type::ResourceRef) } -%> | ||
formatted_params = { | ||
'project': module.params['project'], | ||
<% props.each do |url_prop| -%> | ||
'<%= url_prop.name -%>': replace_resource_dict(module.params['<%= url_prop.name -%>'], '<%= url_prop.imports -%>'), | ||
<% end -%> | ||
} | ||
name = <%= build_url(p.pattern) -%>.format(**formatted_params) | ||
<% else -%> | ||
name = <%= build_url(p.pattern) -%>.format(**module.params) | ||
<% end -%> | ||
|
||
return name | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters