End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OpenStruct#==
==(other)
lib/ostruct.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/ostruct.rb, line 376
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