-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add start_with function #1086
Add start_with function #1086
Conversation
4c17c86
to
f2c1344
Compare
Codecov Report
@@ Coverage Diff @@
## master #1086 +/- ##
=========================================
+ Coverage 4.38% 5.41% +1.03%
=========================================
Files 184 185 +1
Lines 5362 5246 -116
=========================================
+ Hits 235 284 +49
+ Misses 5127 4962 -165
Continue to review full report at Codecov.
|
wmflib::end_with already exists. and although i much prefer ends_with and starts_with i think it makes more sense to make functions like this, a direct map to the ruby equivalent. i.e. also note you can do the following $test =~ "^part${string}01" |
Hey @b4ldr, oh missed that oO I will remove the endswith function from the PR. Do you know when a function which be prefixed with |
no im not sure i thought all modules should be prefixed but ill let someone from puppetlabs give a more authoritative answer |
f2c1344
to
5989922
Compare
5989922
to
5988b0e
Compare
also the current edit: i see you just did thanks :) |
Alright! :) I've updated the PR and tried to adapt the best of both variants :) The last thing missing seems to be an authoritative answer regarding the function namespacing. |
This is helpful in places where you need to use variables in the string which needs to be compare e.g. something like this: ```puppet $test.start_with("part${string}01") ```
5988b0e
to
7091a9d
Compare
Hi @baurmatt , |
Hey @daianamezdrea, I think there was a decision missing: That's the correct naming for function in stdlib? The implementation that you've just merged had both in it and will, at least, confuse people:
|
Hey @daianamezdrea, which naming of the function is correct? Prefixed with I think I've read somewhere (I can't find the link anymore... -.-) that only |
This function was originally introduced in puppetlabs#1086 but never got a decision about the correct namespace. This ensure change ensure namespace similarity to the end_with function to not confuse people.
This function was originally introduced in puppetlabs#1086 but never got a decision about the correct namespace. This commit adds the stdlib:: namespace to the start_with function after a discussion I had with Daneel on Slack about this. This will at least align the namespace with the corresponding end_with function to not confuse people.
This is helpful in places where you need to use variables in the string
which needs to be compare e.g. something like this: