lib/rackspace-monitoring/monitoring/models/base.rb in rackspace-monitoring-0.1.2 vs lib/rackspace-monitoring/monitoring/models/base.rb in rackspace-monitoring-0.1.3
- old
+ new
@@ -6,17 +6,26 @@
class Base < Fog::Model
attribute :created_at
attribute :updated_at
+ # Back to drawing board on this one I think
def hash
attrs = attributes.dup
attrs.delete_if {|key, value| [:created_at, :updated_at, :id].include?(key)}
attrs.delete_if {|key, value| value.kind_of?(Base) }
keys = attrs.keys.map{|sym| sym.to_s}.sort.join ''
values = attrs.values.map{|sym| sym.to_s}.sort.join ''
Digest::MD5.hexdigest(keys + values)
end
+
+ def compare?(b)
+ a_o = prep
+ b_o = b.prep
+ remain = a_o.reject {|key, value| b_o[key] === value}
+ remain.empty?
+ end
+
end
end
end
end