Sha256: adc6d3ff29c746f07131f3ccc656185d2c5fdfb7bdfa80cd044e80f917212c74
Contents?: true
Size: 476 Bytes
Versions: 2
Compression:
Stored size: 476 Bytes
Contents
# $Id: utils.rb 51 2007-11-29 06:01:26Z tim_pease $ module Enumerable def injecting( initial ) inject(initial) do |memo, obj| yield(memo, obj); memo end end end class Hash def sanitize! h = self.injecting({}) do |h, (k, v)| h[k] = case v when 'none', 'nil'; nil when 'true', 'yes'; true when 'false', 'no'; false else v end end self.replace h end end # EOF
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webby-0.6.0 | lib/webby/utils.rb |
webby-0.5.1 | lib/webby/utils.rb |