Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- merb-core/lib/merb-core/core_ext/hash.rb,
merb-cache/lib/merb-cache/core_ext/hash.rb
Instance Method Summary (collapse)
-
- (Array<Object>) extract!(*args)
Returns the value of self for each argument and deletes those entries.
- - (Object) to_sha2
Instance Method Details
- (Array<Object>) extract!(*args)
Returns the value of self for each argument and deletes those entries.
10 11 12 13 14 |
# File 'merb-core/lib/merb-core/core_ext/hash.rb', line 10 def extract!(*args) args.map do |arg| self.delete(arg) end end |
- (Object) to_sha2
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'merb-cache/lib/merb-cache/core_ext/hash.rb', line 5 def to_sha2 string = "" keys.sort_by{|k| k.to_s}.each do |k| case self[k] when Array string << self[k].join when Hash string << self[k].to_sha2 else string << self[k].to_s end end Digest::SHA2.hexdigest(string) end |