Project

General

Profile

Actions

Feature #6056

closed

Enhancements to OpenStruct

Added by trans (Thomas Sawyer) over 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
[ruby-core:42779]

Description

This patch fixes one issue, protecting #new_ostruct_member method, and possibly another by dup'ing marshal_dump, but I need more feedback on the later b/c I've also been told it is not needed.

The rest of this patch provides enhancements to OpenStruct that I feel are sorely needed, these include access via [] and []=, ability to mass update via merge!, minimal polymorphism with Hash and the addition of equality methods, eql? and ==.

https://github.com/ruby/ruby/pull/95

I'd also like opinions on further enhancements:

  • adding #each and #each_pair
  • making OpenStruct a subclass of BasicObject

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #1400: Please add a method to enumerate fields in OpenStructClosedmarcandre (Marc-Andre Lafortune)04/23/2009Actions
Related to Ruby master - Bug #6029: Should OpenStruct implement #eql? and #hash?Closedmarcandre (Marc-Andre Lafortune)02/15/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0