Module: Crimp
- Defined in:
- lib/crimp.rb,
lib/crimp/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.signature(obj) ⇒ Object
27 28 29 |
# File 'lib/crimp.rb', line 27 def self.signature(obj) Digest::MD5.hexdigest( self.stringify obj ) end |
.stringify(obj) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/crimp.rb', line 5 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 |