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

Drop ostruct usage #127

Merged
merged 3 commits into from
Feb 27, 2024
Merged

Drop ostruct usage #127

merged 3 commits into from
Feb 27, 2024

Conversation

viralpraxis
Copy link
Contributor

Resolves #124

I decided to try to make ServiceActor::Result a wrapper around hash instead of defining methods because 1) playing actors in sequence is basically about merging hashes, 2) it's just easier to implement and reason about, 3) I'd like not to to use metaprogramming if it's not required 4) that's basically how ostruct could be implemented (see ruby/ostruct#51 except BasicObject idea)

Seems like resolving #53 will be as easy as tweaking result's #method_missing/#respond_to_missing

@sunny could you please take a look?

Copy link
Owner

@sunny sunny left a comment

Choose a reason for hiding this comment

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

That is awesome 😍 The final result is simpler, too 👏🏻

The spec failure on ruby head comes from the different error format in the next version of Ruby (TIL):

Expected:

undefined method `foobar='

Got:

undefined method 'foobar='

We can simply use a different matcher here to match all versions of Ruby, e.g.:

/undefined method ['`]foobar='/

Also, can you add a small entry to the CHANGELOG? 🙏🏻

@viralpraxis
Copy link
Contributor Author

That is awesome 😍 The final result is simpler, too 👏🏻

The spec failure on ruby head comes from the different error format in the next version of Ruby (TIL):

Expected:

undefined method `foobar='

Got:

undefined method 'foobar='

We can simply use a different matcher here to match all versions of Ruby, e.g.:

/undefined method ['`]foobar='/

Also, can you add a small entry to the CHANGELOG? 🙏🏻

That ruby head issue is unrelated for this PR, I fixed it here: #128 (I'll rebase this one after merging that fix)

Added a note to changelog, see 1b97338

CHANGELOG.md Outdated Show resolved Hide resolved
viralpraxis and others added 3 commits February 27, 2024 21:29
@sunny sunny merged commit c73d688 into sunny:main Feb 27, 2024
6 checks passed
@sunny
Copy link
Owner

sunny commented Feb 27, 2024

Thank you very much for this to-the-point clean refactor 👏🏻 ✨

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.

Consider removing OpenStruct usage
2 participants