Skip to content

Commit

Permalink
Implement Data#==
Browse files Browse the repository at this point in the history
  • Loading branch information
herwinw committed Dec 13, 2024
1 parent 73daef5 commit 42290f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def self.define(*members, &block)
end
end

define_method :== do |other|
self.class == other.class && to_h == other.to_h
end

define_singleton_method(:[]) { |*args, **kwargs| new(*args, **kwargs) }

define_singleton_method(:members) { members }
Expand Down

0 comments on commit 42290f7

Please sign in to comment.