lib/xdr/struct.rb in xdr-0.0.4 vs lib/xdr/struct.rb in xdr-0.1.0

- old
+ new

@@ -7,11 +7,11 @@ extend XDR::Concerns::ConvertsToXDR extend XDR::DSL::Struct attribute_method_prefix 'read_' attribute_method_suffix 'write_' - + class_attribute :fields self.fields = ActiveSupport::OrderedHash.new validates_with XDR::StructValidator @@ -66,9 +66,17 @@ def == (other) return false unless other.is_a?(self.class) other.attributes == self.attributes end + def eql? (other) + return false unless other.is_a?(self.class) + other.attributes.eql? self.attributes + end + + def hash + [self.class, self.attribues].hash + end def read_attribute(attr) @attributes[attr] end