Skip to content

Conversation

@elShiaLabeouf
Copy link

@elShiaLabeouf elShiaLabeouf commented Jun 22, 2023

Please see Issue#267

@elShiaLabeouf elShiaLabeouf force-pushed the feature/represent-to-object branch from 0d0e09c to d81728a Compare June 22, 2023 09:36
README.md Outdated
- `Representable::JSON#to_json`
- `Representable::JSON#to_hash` (provides a hash instead of string)
- `Representable::Hash#to_hash`
- `Representable::Object#to_object` (provides a Struct-based object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then it should be to_struct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we make the object type configurable and Struct is one of the possible targets?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. But having a to_struct shortcut is good too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, module Struct and to_struct fit more, as to_object is too vague. Moved the new code to a new module.

Frankly, I'm kinda confused about configurable object type with Struct as one of the possible targets. What other possible target there could be..? OpenStruct / AnyCustomUserClassPassedAsArgument? I feel like Struct is sufficient and there's no need for other options

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object can return the original object such as ActiveRecord model or a Poro with it attributes set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frankly, I'm kinda confused about configurable object type with Struct as one of the possible targets. What other possible target there could be..?

Imagine a project with Domain::Song, Domain::Song::Duration, Domain::Artist, etc. People might want to transform an object to another domain object?!

@elShiaLabeouf elShiaLabeouf force-pushed the feature/represent-to-object branch from c8ce696 to f548bd1 Compare July 5, 2023 20:29
@elShiaLabeouf elShiaLabeouf force-pushed the feature/represent-to-object branch from f548bd1 to fcf985d Compare July 5, 2023 20:30
@elShiaLabeouf elShiaLabeouf requested review from apotonick and seuros July 5, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants