Sha256: f3d518d0c6e46145709cdbbc9273ed59b22aba6be83238ac220bc8165d92a66a

Contents?: true

Size: 802 Bytes

Versions: 39

Compression:

Stored size: 802 Bytes

Contents

require 'digest/md5'

module Fog
  module Rackspace
    class Monitoring
      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 = params
          b_o = b.params
          remain = a_o.reject {|key, value| b_o[key] === value}
          remain.empty?
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
fog-rackspace-0.1.6 lib/fog/rackspace/models/monitoring/base.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/models/monitoring/base.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/models/monitoring/base.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.5 lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.4 lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.3 lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.2 lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.1 lib/fog/rackspace/models/monitoring/base.rb
fog-rackspace-0.1.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.37.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.36.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.35.0 lib/fog/rackspace/models/monitoring/base.rb
fog-2.0.0.pre.0 lib/fog/rackspace/models/monitoring/base.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/rackspace/models/monitoring/base.rb
fog-1.34.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.33.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.32.0 lib/fog/rackspace/models/monitoring/base.rb
fog-1.31.0 lib/fog/rackspace/models/monitoring/base.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/rackspace/models/monitoring/base.rb