Skip to content

Commit

Permalink
Merge pull request #167 from carbonin/add_count_to_reserved_names
Browse files Browse the repository at this point in the history
Add count to the reserved names list
  • Loading branch information
pkuczynski committed Mar 23, 2017
2 parents fb7d4b8 + 50540e3 commit 4b67740
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/config/options.rb
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
@@ -1,2 +1,3 @@
select: 123
collect: 456
count: 789
3 changes: 3 additions & 0 deletions spec/options_spec.rb
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

0 comments on commit 4b67740

Please sign in to comment.