From ab7039f82014daa072dcfb864b78326c235a49e4 Mon Sep 17 00:00:00 2001 From: Masaki Hara Date: Sat, 4 Jan 2020 23:44:33 +0900 Subject: [PATCH] Fix missing new_ostruct_member in Ruby 2.7 (#255) --- .travis.yml | 6 +++++- CHANGELOG.md | 4 ++++ lib/config/options.rb | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80dcf254..1a96110a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ rvm: - 2.4.5 - 2.5.3 - 2.6.0 + - 2.7.0 - truffleruby gemfile: - gemfiles/rails_4.2.gemfile @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ff6d91..ea4cc754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/lib/config/options.rb b/lib/config/options.rb index c50667e0..e1252920 100644 --- a/lib/config/options.rb +++ b/lib/config/options.rb @@ -201,7 +201,6 @@ 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) @@ -209,7 +208,7 @@ def __convert(h) #:nodoc: v = v.collect { |e| e.instance_of?(Hash) ? __convert(e) : e } end - s.send("#{k}=".to_sym, v) + s[k] = v end s end