Joel Drapper

Results 173 comments of Joel Drapper

These names might not be quite right, but here's the main parts I think we should have: 1. `Renderable` β€” a module that declares that you implement the interface where...

Hey @joelmoss, this was intentional because `to_s` is usually used to represent an object for inspection. All kinds of objects respond to `to_s`, sometimes in unexpected ways β€” even things...

Sorry, I got this wrong. The `format_object` method is only called by Phlex for text output, but I realised you're talking about attribute values.

Regarding attributes, I can see why this is frustrating, but on balance, I _do_ think it's better to use `to_str` rather than `to_s`. So many objects respond to `to_s` in...

There are a few articles on this topic: - https://blog.appsignal.com/2018/09/25/explicitly-casting-vs-implicitly-coercing-types-in-ruby.html - https://www.rubyguides.com/2018/09/ruby-conversion-methods/ Essentially, every Ruby class (with the exception of `BasicObject`) implements `to_s`, either as the default object inspect representation...

We could allow `text` to call `to_s` on the object. I don’t like the idea of using `to_s` for implicit text (from the block return) because *every* object in ruby...

> Could show an example? What I mean is this wouldn't call `to_s` on the object. ```ruby h1 { object } ``` But this would ```ruby h1 { text object...

πŸ€¦β€β™‚οΈ Oh god, I keep doing this. I guess it makes sense to call `to_s` on objects passed as attributes, though I’d prefer an interface that allows you to have...

I’d prefer to try `to_str` before `to_s`, but it's probably better for performance to call `to_s` first since β€” let's be honest β€” almost no object implements `to_str`. πŸ˜…

Thanks for the feedback @wdiechmann. All of these changes were made after very careful consideration and documented in the [release notes](https://github.com/phlex-ruby/phlex/releases). Turbo stream shouldn't have stopped working though. Could you...