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 method to convert NumberLiteral type and/or stringify without type suffix #10462

Closed
straight-shoota opened this issue Mar 1, 2021 · 0 comments · Fixed by #10802
Closed

Comments

@straight-shoota
Copy link
Member

Stringifying a NumberLiteral always adds a the type suffix unless the type is Int32 (which is the default).

{% p 1_u8.id %} # => 1_u8

It seems there is currently no way to remove that type suffix, for example for cleanly stringifying the value (see #10460).

A good solution is probably adding NumberLiteral#to_i to converts to an Int32 literal which is without type suffix. This can than be used to stringify or construct other number literals.

beta-ziliani pushed a commit that referenced this issue Jun 21, 2021
* Add NumberLiteral#to_number (Resolves #10462)

* Add TODO to workaround in YAML::Serializable.use_yaml_discriminator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant