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

Typo #8

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions _posts/2017-01-23-ruby-to-s-to-str.md
Expand Up @@ -105,7 +105,7 @@ rb_str_to_s(VALUE str)

[Exception][3] used to implement `to_str` as well but is was removed in Ruby 1.9, which is why it's often mentionned as an example. The Ruby documentation was even wrong at the time of writing this article, so I wrote [a PR to fix it][4] that was merged.

There are a lot of discussions regarding if a class should implement `to_str` or not, since it's a strong signal that the class is really similar to a string and should behave as such. If this sounds interesting, you should take a look at this [Symbol#to_str][5] discussion on the Ruby core tracker, or at [this example in Rails][6] of when `to_str` is usefull by [Aaron Patterson][7].
There are a lot of discussions regarding if a class should implement `to_str` or not, since it's a strong signal that the class is really similar to a string and should behave as such. If this sounds interesting, you should take a look at this [Symbol#to_str][5] discussion on the Ruby core tracker, or at [this example in Rails][6] of when `to_str` is useful by [Aaron Patterson][7].

#### Example 1: Fixnum

Expand Down Expand Up @@ -167,4 +167,4 @@ That's a lot of information, but let me sum it up quickly before finishing the a
[4]: https://github.com/ruby/ruby/pull/1517
[5]: https://bugs.ruby-lang.org/issues/7849
[6]: https://github.com/rails/rails/commit/188cc90af9b29d5520564af7bd7bbcdc647953ca
[7]: https://twitter.com/tenderlove
[7]: https://twitter.com/tenderlove