Skip to content

Commit b35f4af

Browse files
yhattpkuczynski
authored andcommitted
Replace Config::Options#delegate to simple method definitions (#185)
1 parent 95ce7c0 commit b35f4af

15 files changed

Lines changed: 95 additions & 26 deletions

File tree

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ gemfile:
1313
- gemfiles/rails_4.1.gemfile
1414
- gemfiles/rails_4.2.gemfile
1515
- gemfiles/rails_5.gemfile
16+
- gemfiles/sinatra.gemfile
1617
matrix:
1718
exclude:
1819
- rvm: 2.0.0
1920
gemfile: gemfiles/rails_5.gemfile
21+
- rvm: 2.0.0
22+
gemfile: gemfiles/sinatra.gemfile
2023
- rvm: 2.1.10
2124
gemfile: gemfiles/rails_5.gemfile
25+
- rvm: 2.1.10
26+
gemfile: gemfiles/sinatra.gemfile
2227
- rvm: 2.2.6
2328
gemfile: gemfiles/rails_3.gemfile
2429
- rvm: 2.3.3

Appraisals

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ end
1919
appraise 'rails-5' do
2020
gem 'rails', '5.0.1'
2121
end
22+
23+
appraise 'sinatra' do
24+
gem 'sinatra', '2.0.0'
25+
end

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Unreleased
44

5-
* Makje dry-validation dependency less strict allowing to use newer versions ([#183](https://github.com/railsconfig/config/pull/183))
5+
* Make dry-validation dependency less strict allowing to use newer versions ([#183](https://github.com/railsconfig/config/pull/183))
6+
* 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))
67

78
## 1.6.0
89

gemfiles/rails_3.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ source "https://rubygems.org"
44

55
gem "rails", "3.2.22.4"
66

7-
gemspec :path => "../"
7+
gemspec path: "../"

gemfiles/rails_4.1.gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "rails", "4.1.16"
6-
gem "tzinfo-data", :platforms => [:mingw, :mswin, :x64_mingw]
6+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw]
77

8-
gemspec :path => "../"
8+
gemspec path: "../"

gemfiles/rails_4.2.gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "rails", "4.2.7.1"
6-
gem "tzinfo-data", :platforms => [:mingw, :mswin, :x64_mingw]
6+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw]
77

8-
gemspec :path => "../"
8+
gemspec path: "../"

gemfiles/rails_4.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ source "https://rubygems.org"
44

55
gem "rails", "4.0.13"
66

7-
gemspec :path => "../"
7+
gemspec path: "../"

gemfiles/rails_5.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ source "https://rubygems.org"
44

55
gem "rails", "5.0.1"
66

7-
gemspec :path => "../"
7+
gemspec path: "../"

gemfiles/sinatra.gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "sinatra", "2.0.0"
6+
7+
gemspec path: "../"

lib/config/options.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ def []=(param, value)
153153
end
154154
end
155155

156-
delegate :key?, :has_key?, to: :table
156+
def key?(key)
157+
table.key?(key)
158+
end
159+
160+
def has_key?(key)
161+
table.has_key?(key)
162+
end
157163

158164
def method_missing(method_name, *args)
159165
if Config.fail_on_missing && method_name !~ /.*(?==\z)/m

0 commit comments

Comments
 (0)