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

Case matching operator for results #120

Closed
julik opened this issue May 27, 2018 · 1 comment
Closed

Case matching operator for results #120

julik opened this issue May 27, 2018 · 1 comment

Comments

@julik
Copy link
Contributor

julik commented May 27, 2018

If we implement the case matching on our Result objects we could in theory make the following usage pattern possible:

result = FormatParser.parse(...)
case result
when :image
  # render thumbnail
when :audio
  # render soundbite
when :video
  # extract the first N seconds and render soundbite
else
  # render a generic icon and be done...
end
@julik
Copy link
Contributor Author

julik commented May 27, 2018

Meh, that is not possible to do because the threequals operator cannot be inversed. In this code example the symbol would be the receiver of the ===, not the result.

@julik julik closed this as completed May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant