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

add specs for Data.define #995

Merged
merged 1 commit into from
Jan 12, 2023
Merged

Conversation

lxxxvi
Copy link
Contributor

@lxxxvi lxxxvi commented Jan 11, 2023

Hello again 👋

Here's an attempt for Data.define that is related to:

  • New core class to represent simple immutable value object. The class is similar to Struct and partially shares an implementation, but has more lean and strict API. [Feature #16122]

I got confused by the Documentation (https://docs.ruby-lang.org/en/3.2/Data.html) that says

define(name, *symbols) → class
define(*symbols) → class

Defines a new Data class. If the first argument is a string, the class is stored in Data::<name> constant.

I believe the define(name, *symbols) is either wrongly documented or not implented. If I read the discussion about the Feature correctly (https://bugs.ruby-lang.org/issues/16122 ), it's not supposed to be implemented, do you agree?

I added a failing test for it nonetheless.

As always, thank you very much for your review. Let me know what else I can improve. 🙌

@eregon
Copy link
Member

eregon commented Jan 11, 2023

I believe the define(name, *symbols) is either wrongly documented or not implented.

Yeah the docs are wrong, it's on purpose not there and a legacy thing of Struct.

core/data/define_spec.rb Outdated Show resolved Hide resolved
core/data/define_spec.rb Outdated Show resolved Hide resolved
@eregon
Copy link
Member

eregon commented Jan 11, 2023

This reminds I should create an issue to track specs for 3.2 😅

@lxxxvi
Copy link
Contributor Author

lxxxvi commented Jan 12, 2023

@eregon I applied the changes you suggested, let me know if something is missing or can be improved. Thanks a lot.

@lxxxvi
Copy link
Contributor Author

lxxxvi commented Jan 12, 2023

Yeah the docs are wrong, it's on purpose not there and a legacy thing of Struct.

I just saw that the documentation has already been updated on master

Will this be updated in the docs when 3.2.1 is released, or earlier?

@eregon
Copy link
Member

eregon commented Jan 12, 2023

See ruby/ruby#7038 (comment)

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

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

Thanks!

@eregon eregon merged commit f5488f5 into ruby:master Jan 12, 2023
@lxxxvi lxxxvi deleted the add-tests-for-Data-define branch January 12, 2023 15:42
@eregon
Copy link
Member

eregon commented May 5, 2023

This reminds I should create an issue to track specs for 3.2 😅

Done now: #1016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants