Class: Fog::Rackspace::Monitoring::Base

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rackspace/models/monitoring/base.rb

Instance Method Summary collapse

Instance Method Details

#compare?(b) ⇒ Boolean

Returns:

  • (Boolean)

20
21
22
23
24
25
# File 'lib/fog/rackspace/models/monitoring/base.rb', line 20

def compare?(b)
  a_o = params
  b_o = b.params
  remain = a_o.reject {|key, value| b_o[key] === value}
  remain.empty?
end

#hashObject

Back to drawing board on this one I think


11
12
13
14
15
16
17
18
# File 'lib/fog/rackspace/models/monitoring/base.rb', line 11

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