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

Add StringLiteral#titleize macro method #9269

Merged
merged 2 commits into from
May 15, 2020

Conversation

makenowjust
Copy link
Contributor

This also adds SymbolLiteral#titleize and MacroId#titleize.

Other case conversion methods (upcase, camelcase, etc) are avialble in macro. So, titleize should not be exception.

One use-case is generating error message from type name.

This also adds `SymbolLiteral#titleize` and `MacroId#titleize`.

Other case conversion methods (`upcase`, `camelcase`, etc)  are avialble
in macro. So, `#titleize` should not be exception.

One use-case is generating error message from type name.
@straight-shoota
Copy link
Member

There are no specs for MacroId and SymbolLiteral and it seems the implementation is missing for those, too.

@makenowjust
Copy link
Contributor Author

makenowjust commented May 10, 2020

@straight-shoota SymbolLiteral and MacroId implementations delegate to StringLiteral implementation (see here and here). So, no problem.

And, other methods of SymbolLiteral and MacroId lacks their specs too.

@watzon
Copy link
Contributor

watzon commented May 13, 2020

Do we have this method on standard strings? If so I must've missed the PR, but if not it would be nice to have it there too.

@straight-shoota
Copy link
Member

straight-shoota commented May 13, 2020

@watzon This PR uses the exact method as implementation:

interpret_argless_method(method, args) { StringLiteral.new(@value.titleize) }

It was added in #9204

@watzon
Copy link
Contributor

watzon commented May 13, 2020

Yeah I saw that when I was going through the code, I guess I missed the PR. Awesome though, I've wished it was there a number of times.

@bcardiff bcardiff added this to the 0.35.0 milestone May 14, 2020
@bcardiff bcardiff merged commit 1e19a23 into crystal-lang:master May 15, 2020
@makenowjust makenowjust deleted the feat/macro-titleize branch May 15, 2020 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants