Skip to content
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

[ci skip] show the correct example to demonstrate inflections. #31014

Merged
merged 1 commit into from
Nov 4, 2017

Conversation

aditya-kapoor
Copy link
Contributor

Show the correct example as mentioned in #31008.

Closes #31008

@phedkvist
Copy link
Contributor

Line 84 and 74 still have the unwanted example.

@aditya-kapoor
Copy link
Contributor Author

@phedkvist In #31008 I think we are looking at incorrect test case, because the test case in question has dash instead of underscore and the test case specifies the separator as _ instead of -. The other examples specified I think are correct and would work with default value of separator as -.

ActiveSupport::Inflector.parameterize("^trés|Jolie--") 
# => "tres_jolie"
ActiveSupport::Inflector.parameterize("^trés|Jolie-- ", preserve_case: true) 
# => "tres-Jolie"
ActiveSupport::Inflector.parameterize("^trés|Jolie--", separator: "_") 
# => "tres_jolie--"

@peagha
Copy link

peagha commented Oct 31, 2017

I find it important to document the special dash and underscore behavior, wdyt of:

# It preserves dashes and underscores unless they are used as separators:
#
#  parameterize("^trés|Jolie__ ")                 # => "tres-jolie__"
#  parameterize("^trés|Jolie-- ", separator: "_") # => "tres_jolie--"
#  parameterize("^trés_Jolie-- ", separator: ".") # => "tres_jolie--"

It took me a long time to find out that parameterize had this behavior, so I expect this info to help other programmers in the future

@rafaelfranca
Copy link
Member

👍 for @peagha suggestion

@aditya-kapoor
Copy link
Contributor Author

@peagha @rafaelfranca Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants