Skip to content

Commit

Permalink
Fix missing new_ostruct_member in Ruby 2.7 (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
qnighy authored and pkuczynski committed Jan 4, 2020
1 parent 5368594 commit ab7039f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rvm:
- 2.4.5
- 2.5.3
- 2.6.0
- 2.7.0
- truffleruby
gemfile:
- gemfiles/rails_4.2.gemfile
Expand All @@ -14,7 +15,10 @@ gemfile:
- gemfiles/sinatra.gemfile
matrix:
exclude:
# truffleruby does not seem to work with Rails
# Bundler 2.x coming with Ruby 2.7 does not work well with rails 4.2
- rvm: 2.7.0
gemfile: gemfiles/rails_4.2.gemfile
# TruffleRuby does not seem to work with Rails
- rvm: truffleruby
gemfile: gemfiles/rails_4.2.gemfile
- rvm: truffleruby
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* Get rid of unused Rails Engine class definition ([#247](https://github.com/railsconfig/config/pull/247))
* Require dry-validation only when schema is specified ([#253](https://github.com/railsconfig/config/pull/253))

### Bug fixes

* Fix missing new_ostruct_member in Ruby 2.7 ([#255](https://github.com/railsconfig/config/pull/255))

### Changes

* Use sprockets 3.x when running unit tests for Rails 4.2 ([#256](https://github.com/railsconfig/config/pull/256))
Expand Down
3 changes: 1 addition & 2 deletions lib/config/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,14 @@ def __convert(h) #:nodoc:

h.each do |k, v|
k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)
s.new_ostruct_member(k)

if v.is_a?(Hash)
v = v["type"] == "hash" ? v["contents"] : __convert(v)
elsif v.is_a?(Array)
v = v.collect { |e| e.instance_of?(Hash) ? __convert(e) : e }
end

s.send("#{k}=".to_sym, v)
s[k] = v
end
s
end
Expand Down

0 comments on commit ab7039f

Please sign in to comment.