-
Notifications
You must be signed in to change notification settings - Fork 188
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 Data.define #3341
Add Data.define #3341
Conversation
Thank you, I'll take it from here. |
f91a411
to
86be023
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's passing both specs and MRI tests now, so should be good to go.
@@ -419,7 +419,7 @@ def pretty_print_cycle(q) # :nodoc: | |||
class Data # :nodoc: | |||
def pretty_print(q) # :nodoc: | |||
q.group(1, sprintf("#<data %s", PP.mcall(self, Kernel, :class).name), '>') { | |||
q.seplist(PP.mcall(self, Data, :members), lambda { q.text "," }) {|member| | |||
q.seplist(PP.mcall(self, Kernel, :class).members, lambda { q.text "," }) {|member| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because we don't define Data#members
but define it on the instance_methods_module
.
I don't think it makes much sense to define it on Data
as it would be a megamorphic call to members
on the actual object's class.
So rather I think we should upstream this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a67180e
to
fb54b5e
Compare
25437f5
to
0edc91b
Compare
Adds a 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. See this redmine discussion for more.
Still in an incomplete state.