Sha256: 64f5c0c7bb610e14faae7f2e3c04bf787bf8727ccfd09f0161b53e46d396903a

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

require 'digest/md5'

module Fog
  module Monitoring
    class Rackspace
      class Base < Fog::Model

        attribute :created_at
        attribute :updated_at

        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rackspace-monitoring-0.1.2 lib/rackspace-monitoring/monitoring/models/base.rb