Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
OpenStruct#==
(untyped other) -> bool
==(other)
lib/ostruct.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/ostruct.rb, line 423
def ==(other)
return false unless other.kind_of?(OpenStruct)
@table == other.table!
end
Compares this object and other for equality. An OpenStruct is equal to other when other is an OpenStruct and the two objects’ Hash tables are equal.
Example
require "ostruct" first_pet = OpenStruct.new("name" => "Rowdy") second_pet = OpenStruct.new(:name => "Rowdy") third_pet = OpenStruct.new("name" => "Rowdy", :age => nil) first_pet == second_pet # => true first_pet == third_pet # => false