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

Allow block to be specified for cattr_reader, also add default param #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eamonn-webster
Copy link

My use case is to a reader only class attribute, but then I must be able to specify the initial value with a block or via default:

My use case is to a reader only class attribute, but then I must
be able to specify the initial value with a block or via default:
@eamonn-webster
Copy link
Author

@andrewhavens / @wndxlori: the existing specs fail locally for me, something appears broken in the Duration code implementing 2.days.ago. I don't use that code, I'll try to take a look when I get a chance.

@class.rdrd.should == 'default'
end

it "should return default if one was given for specified" do
Copy link
Contributor

Choose a reason for hiding this comment

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

given for instance

@wndxlori
Copy link
Contributor

wndxlori commented Feb 5, 2024

@andrewhavens / @wndxlori: the existing specs fail locally for me, something appears broken in the Duration code implementing 2.days.ago. I don't use that code, I'll try to take a look when I get a chance.

I seem to remember getting stuck on that issue the last time I was attempting a fix in here. Thanks if you can figure it out!

@eamonn-webster
Copy link
Author

@wndxlori I can fix it by making Duration an ordinary class, i.e. drop the inherit from BasicObject. But I have no idea why it is failing. I guess that's a question for @amirrajan

@wndxlori
Copy link
Contributor

wndxlori commented Feb 8, 2024

@wndxlori I can fix it by making Duration an ordinary class, i.e. drop the inherit from BasicObject. But I have no idea why it is failing. I guess that's a question for @amirrajan

I'm on board with that. If the specs run, let's :shipit:

@eamonn-webster
Copy link
Author

This is the error when MotionSupport::Duration inherits from BasicObject

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   <translation info unavailable>	       0x100ee045c ???
1   CoreFoundation                	       0x109c798ed __methodDescriptionForSelector + 75
2   CoreFoundation                	       0x109c79a5a -[NSObject(NSObject) methodSignatureForSelector:] + 30
3   MotionSupport                 	       0x10040d960 rb_objc_supports_forwarding + 48
4   MotionSupport                 	       0x1004290e9 rb_vm_dispatch + 1273
5   MotionSupport                 	       0x100380d8a coerce_body + 202
6   MotionSupport                 	       0x10044eca1 rb_rescue2 + 113
7   MotionSupport                 	       0x100374498 rb_objc_num_coerce_bin + 72
8   MotionSupport                 	       0x10042a6e3 rb_vm_dispatch + 6899
9   MotionSupport                 	       0x1000c3abd vm_dispatch + 1325
10  MotionSupport                 	       0x1000c44ab vm_fast_mult + 795
11  MotionSupport                 	       0x1000c6625 rb_scope__days__ + 149 (time.rb: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.

2 participants