ruby / date

A subclass of Object includes Comparable module for handling dates.
Other
70 stars 35 forks source link

Implement Date#deconstruct_keys and DateTime#deconstruct_keys #80

Closed zverok closed 1 year ago

zverok commented 1 year ago

Same as https://github.com/ruby/ruby/pull/6594, but for Date & DateTime.

zverok commented 1 year ago

Hmm, interesting, it seems to only be compilable under 3.2 :thinking: Should I surround new code with a version-specific macro?

jeremyevans commented 1 year ago

Sorry that I haven't had a chance to review this yet, I'm currently at RubyConfTH and haven't had a lot of free time. I should be able to review next week.

From a brief review of the build error, you can probably switch from rb_hash_new_capa to just rb_hash_new. Unless you can see a significant performance improvement from using rb_hash_new_capa on 3.2, I would avoid the optimization and keep the code the same for all ruby versions.

zverok commented 1 year ago

@jeremyevans Yeah, makes sense. All green now.