Sha256: f2ef4b581f204f20cc0b6318e0f4ffd079f025c96c8671fedcfdf46191242212
Contents?: true
Size: 714 Bytes
Versions: 4
Compression:
Stored size: 714 Bytes
Contents
require 'singleton' require 'digest/md5' require 'active_support' require 'active_support/version' %w{ active_support/core_ext/hash/keys active_support/core_ext/object/to_query }.each do |active_support_3_requirement| require active_support_3_requirement end if ::ActiveSupport::VERSION::MAJOR == 3 class RemoteTable class Hasher include ::Singleton def hash(row) str = if row.is_a?(::Array) tmp_ary = [] row.each_with_index do |v, i| tmp_ary.push v.to_query(i.to_s) end tmp_ary else row.stringify_keys.keys.sort.map do |k| row[k].to_query k end end.join('&') ::Digest::MD5.hexdigest str end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
remote_table-1.2.3 | lib/remote_table/hasher.rb |
remote_table-1.2.2 | lib/remote_table/hasher.rb |
remote_table-1.2.1 | lib/remote_table/hasher.rb |
remote_table-1.2.0 | lib/remote_table/hasher.rb |