rubyconfig/config

`max` and `min` as settings names behave unexpectedly

supremebeing7 opened this issue · 2 comments

This is on version 2.0.0

Using max and min appear to be reserved words and will behave unexpectedly.

settings_group:
  max: "max"
  min: "min"
  other: "other"

Expected

> Settings.settings_group.max
=> "max"
> Settings.settings_group.min
=> "min"
> Settings.settings_group.other
=> "other"

Actual

> Settings.settings_group.max
=> [:other, "other"]
> Settings.settings_group.min
=> [:max, "max"]
> Settings.settings_group.other
=> "other"

I assume this is happening because config groups are being treated in some way like arrays?

[1] pry(main)> [1,2,3].max
=> 3
[2] pry(main)> [1,2,3].min
=> 1

I think I've got a fix, it's just adding those to the SETTINGS_RESERVED_WORDS. I'll get a PR up in a second.