forked from pact-foundation/pact-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add consumer_version_selectors to pact verification DSL, and co…
…nvert consumer_version_tags to selectors
- Loading branch information
Showing
6 changed files
with
122 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Can't use refinements because of Travelling Ruby | ||
|
||
module Pact | ||
module Utils | ||
module String | ||
|
||
extend self | ||
|
||
# ripped from rubyworks/facets, thank you | ||
def camelcase(string, *separators) | ||
case separators.first | ||
when Symbol, TrueClass, FalseClass, NilClass | ||
first_letter = separators.shift | ||
end | ||
|
||
separators = ['_', '\s'] if separators.empty? | ||
|
||
str = string.dup | ||
|
||
separators.each do |s| | ||
str = str.gsub(/(?:#{s}+)([a-z])/){ $1.upcase } | ||
end | ||
|
||
case first_letter | ||
when :upper, true | ||
str = str.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase } | ||
when :lower, false | ||
str = str.gsub(/(\A|\s)([A-Z])/){ $1 + $2.downcase } | ||
end | ||
|
||
str | ||
end | ||
end | ||
end | ||
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
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