lib/squares/base.rb in squares-0.2.7 vs lib/squares/base.rb in squares-0.2.8
- old
+ new
@@ -17,9 +17,17 @@
def properties
self.class.properties
end
+ def to_h(key_name = :id)
+ h = { key_name => id }
+ properties.each do |property|
+ h[property] = self.send(property)
+ end
+ h
+ end
+
private
def properties_equal other
! properties.detect do |property|
self.send(property) != other.send(property)