ostruct icon indicating copy to clipboard operation
ostruct copied to clipboard

OpenStruct implementation

Results 16 ostruct issues
Sort by recently updated
recently updated
newest added

The `respond_to_missing` function in `lib/ostruct.rb` is causing issues when using versions of Ruby < 2.3.0 ``` def respond_to_missing?(mid, include_private = false) # :nodoc: mname = mid.to_s.chomp("=").to_sym @table&.key?(mname) || super end...

This PR only creates new singleton methods when they are needed for overwriting an existing instance method. It should be mostly backward-compatible with the current OpenStruct implementation, but I suspect...

/src/vendor/bundle/ruby/3.4.0/gems/ostruct-0.6.1/lib/ostruct.rb:245: warning: redefining 'object_id' may cause serious problems Since we updated our code to ruby 3.4.2 we see this warning when we run rspecs

Adds has_key? method to OpenStruct class to check if a given name exists as a member, which allows checking for presence of a key without creating an accessor method; it...

There is a current test failure on TruffleRuby, in the test `test_performance_warning(TC_OpenStruct)`. ``` =============================================================================== Failure: test_performance_warning(TC_OpenStruct): pid 1875 exit 0 | /home/runner/.rubies/truffleruby-24.1.1/lib/mri/rubygems.rb:1207: warning: unstable interpolated regexps cause deoptimization loops which...

I am on Ruby 3.0 With stdlib ostruct I get: ``` irb(main):002:0> x = OpenStruct.new => # irb(main):002:0> x.varname1 = 'varval 1' => "varval 1" irb(main):003:0> x.to_h => {:varname1=>"varval 1"}...