lib/lite/ruby/open_struct.rb in lite-ruby-1.1.12 vs lib/lite/ruby/open_struct.rb in lite-ruby-1.1.13

- old
+ new

@@ -63,11 +63,16 @@ # rubocop:enable Metrics/MethodLength, Naming/PredicateName def new_ostruct_member!(name) return if is_method_protected!(name) - define_singleton_method!(name) { @table[name] } - define_singleton_method!("#{name}=") { |x| @table[name] = x } + if respond_to?(:define_singleton_method!) + define_singleton_method(name) { @table[name] } + define_singleton_method("#{name}=") { |x| @table[name] = x } + else + define_singleton_method!(name) { @table[name] } + define_singleton_method!("#{name}=") { |x| @table[name] = x } + end end end end