class Mutations::SymbolFilter

Public Instance Methods

filter(data) click to toggle source
# File lib/mutations/symbol_filter.rb, line 8
def filter(data)
  if data.nil?
    return [nil, nil] if options[:nils]
    return [nil, :nils]
  end

  case data
  when Symbol # we're good!
  when String then data = data.to_sym
  else return [nil, :symbol]
  end

  # Ensure it matches `in`
  return [data, :in] if options[:in] && !options[:in].include?(data)

  [data, nil]
end