Sha256: 16a190b85ee2639040be043084f144594d712196ddd8c101aa3745c7a246b41f
Contents?: true
Size: 514 Bytes
Versions: 30
Compression:
Stored size: 514 Bytes
Contents
module Mutations class SimpleHashFilter < AdditionalFilter @default_options = { :nils => false # true allows an explicit nil to be valid. Overrides any other options } def filter(data) # Handle nil case if data.nil? return [nil, nil] if options[:nils] return [nil, :nils] end # Now check if it's empty: return [data, :empty] if data == {} # If data is a hash, we win. return [data, nil] if data.is_a? Hash end end end
Version data entries
30 entries across 30 versions & 1 rubygems