Sha256: a432c4d87c40255c4a9ca036532326cc7585e58be44a175dfe75d252cf804da3

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

require "crimp/version"
require "digest"

module Crimp
  def self.stringify(obj)
    if obj.class == Hash
      arr = []
      obj.each do |key, value|
        arr << "#{self.stringify key}=>#{self.stringify value}"
      end
      obj = arr
    end
    if obj.class == Array
      str = ''
      obj.map! do |value|
        self.stringify value
      end.sort!.each do |value|
        str << value
      end
    end
    if obj.class != String
      obj = obj.to_s << obj.class.to_s
    end
    obj
  end

  def self.signature(obj)
    Digest::MD5.hexdigest( self.stringify obj )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crimp-0.0.1 lib/crimp.rb