confstruct icon indicating copy to clipboard operation
confstruct copied to clipboard

"display" reserved word for key?

Open jrochkind opened this issue 13 years ago • 4 comments

Is there a reason "display" would be a reserved word for a key? Traced my weird bug down to that.

 hash = {:display=> "display", :foo => 'foo'}
 conf = Confstruct::Configuration.new( hash )

conf.foo           # => 'foo'
conf.display    # => #<Confstruct::Configuration:0x0000000fff4b78>nil
conf[:display]  # => 'display'

Looks like 'display' is for some reason 'special'/reserved, but I am not sure why or if this is a bug. Took me a while to reproduce and figure out it really was the key 'display' that did it!

jrochkind avatar Sep 12 '12 18:09 jrochkind

Ah, weird #display is a method on ruby Object, although not one I had ever heard of or seen before. http://apidock.com/ruby/v1_9_2_180/Object/display

Okay then.

I wonder if confstruct actually ought to remove some methods from Object, or use 1.9 "BasicObject" or something. I dunno, I guess this is just downside of automatic struct-ization like that.

jrochkind avatar Sep 12 '12 18:09 jrochkind

Huh, I had never heard of #display, either. Interesting. I'm already removing some methods from Object, but I can take a look at this one sometime next week.

mbklein avatar Sep 13 '12 01:09 mbklein

We are now having facing the same issue with the name entries. Do you plan to support names of functions that already exist as well?

hoenic07 avatar Dec 11 '18 07:12 hoenic07

I've been using railsconfig for a while now, so I can't say there's going to be much ongoing support for confstruct. I'm happy to consider PRs and work others want to contribute, but I probably won't be making direct improvements myself.

mbklein avatar Dec 11 '18 19:12 mbklein