Sha256: 4a1a814fe7f508341f8d693758f4557a3e8aa0cfc0f4ed4ce811b7c29bd62671
Contents?: true
Size: 1 KB
Versions: 6
Compression:
Stored size: 1 KB
Contents
module Base @@evaluate = false def evaluate(value=true) @@evaluate = value return(self) end def evaluate? value = @@evaluate @@evaluate = false return(value) end private def metaform(value) value.nil? ? value : (eval(value) rescue value) end def metamorph(args) case args.class.name when "Array" args.first.is_a?(Array) ? args.map { |h| h.map { |v| metaform(v) } } : args.map { |v| metaform(v) } when "Hash" args.each { |k, v| args[k] = metaform(v) } else metaform(args) end end def metatransform(value) value.empty? ? nil : (evaluate? ? metamorph(value) : value) end def normalize_key(key) key.to_s end def stringify_keys(value) value.map { |k, v| k.to_s } end def append?(order) "append" == order.to_s end def prepend?(order) "prepend" == order.to_s end def milliseconds?(format) "milliseconds" == format.to_s end def seconds?(format) "seconds" == format.to_s end end
Version data entries
6 entries across 6 versions & 1 rubygems