Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add count to the reserved names list #167

Merged
merged 1 commit into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/config/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def merge!(hash)
end

# Some keywords that don't play nicely with OpenStruct
SETTINGS_RESERVED_NAMES = %w{select collect test}
SETTINGS_RESERVED_NAMES = %w{select collect test count}

# An alternative mechanism for property access.
# This let's you do foo['bar'] along with foo.bar.
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/reserved_keywords.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
select: 123
collect: 456
count: 789
3 changes: 3 additions & 0 deletions spec/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
it 'should allow to access them via object member notation' do
expect(config.select).to eq(123)
expect(config.collect).to eq(456)
expect(config.count).to eq(789)
end

it 'should allow to access them using [] operator' do
expect(config['select']).to eq(123)
expect(config['collect']).to eq(456)
expect(config['count']).to eq(789)

expect(config[:select]).to eq(123)
expect(config[:collect]).to eq(456)
expect(config[:count]).to eq(789)
end
end

Expand Down