class Mutations::DuckFilter
Public Instance Methods
filter(data)
click to toggle source
# File lib/mutations/duck_filter.rb, line 8 def filter(data) # Handle nil case if data.nil? return [nil, nil] if options[:nils] return [nil, :nils] end # Ensure the data responds to each of the methods Array(options[:methods]).each do |method| return [data, :duck] unless data.respond_to?(method) end # We win, it's valid! [data, nil] end