lib/ridley/resource.rb in ridley-0.2.0 vs lib/ridley/resource.rb in ridley-0.2.1

- old
+ new

@@ -3,10 +3,11 @@ module Resource extend ActiveSupport::Concern include ActiveModel::AttributeMethods include ActiveModel::Validations include ActiveModel::Serializers::JSON + include Comparable included do attribute_method_suffix('=') end @@ -285,18 +286,26 @@ end # @param [Object] other # # @return [Boolean] + def <=>(other) + self.chef_id <=> other.chef_id + end + def ==(other) - self.attributes == other.attributes + self.chef_id == other.chef_id end # @param [Object] other # # @return [Boolean] def eql?(other) - other.is_a?(self.class) && send(:==, other) + self.class == other.class && self == other + end + + def hash + self.chef_id.hash end private attr_reader :connection