Skip to content

Commit 0820c8d

Browse files
niclinpkuczynski
authored andcommitted
Add zip to the list of reserved keywords (#197)
1 parent 2ad2542 commit 0820c8d

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Fix `key?` and `has_key?`, which raise NoMethodError in non Rails environment, by using ActiveSupport `#delegate` implicitly ([#185](https://github.com/railsconfig/config/pull/185))
77
* Update `deep_merge` dependency to latest version (v1.2.1) ([#191](https://github.com/railsconfig/config/pull/191))
88
* Upgrade `rubocop` to version 0.52.1 ([#193](https://github.com/railsconfig/config/pull/193))
9+
* Add `zip` to the list of reserved keywords ([#197](https://github.com/railsconfig/config/pull/197))
910

1011
## 1.6.0
1112

lib/config/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def merge!(hash)
134134
end
135135

136136
# Some keywords that don't play nicely with OpenStruct
137-
SETTINGS_RESERVED_NAMES = %w{select collect test count}
137+
SETTINGS_RESERVED_NAMES = %w[select collect test count zip].freeze
138138

139139
# An alternative mechanism for property access.
140140
# This let's you do foo['bar'] along with foo.bar.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
select: 123
2-
collect: 456
3-
count: 789
1+
select: apple
2+
collect: banana
3+
count: lemon
4+
zip: cherry

spec/options_spec.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@
88
end
99

1010
it 'should allow to access them via object member notation' do
11-
expect(config.select).to eq(123)
12-
expect(config.collect).to eq(456)
13-
expect(config.count).to eq(789)
11+
expect(config.select).to eq('apple')
12+
expect(config.collect).to eq('banana')
13+
expect(config.count).to eq('lemon')
14+
expect(config.zip).to eq('cherry')
1415
end
1516

1617
it 'should allow to access them using [] operator' do
17-
expect(config['select']).to eq(123)
18-
expect(config['collect']).to eq(456)
19-
expect(config['count']).to eq(789)
20-
21-
expect(config[:select]).to eq(123)
22-
expect(config[:collect]).to eq(456)
23-
expect(config[:count]).to eq(789)
18+
expect(config['select']).to eq('apple')
19+
expect(config['collect']).to eq('banana')
20+
expect(config['count']).to eq('lemon')
21+
expect(config['zip']).to eq('cherry')
22+
23+
expect(config[:select]).to eq('apple')
24+
expect(config[:collect]).to eq('banana')
25+
expect(config[:count]).to eq('lemon')
26+
expect(config[:zip]).to eq('cherry')
2427
end
2528
end
2629

0 commit comments

Comments
 (0)