Sha256: f2a39efcd98d06f77126f83533460d5dbe2c60284b56789a51a794fc910ee741
Contents?: true
Size: 678 Bytes
Versions: 4
Compression:
Stored size: 678 Bytes
Contents
module Mutations class InputFilter @default_options = {} def self.default_options @default_options end attr_accessor :options def initialize(opts = {}) self.options = (self.class.default_options || {}).merge(opts) end # returns -> [sanitized data, error] # If an error is returned, then data will be nil def filter(data) [data, nil] end def has_default? options.has_key?(:default) end def default options[:default] end # Only relevant for optional params def discard_nils? !options[:nils] end def discard_empty? options[:discard_empty] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mutations-0.6.0 | lib/mutations/input_filter.rb |
mutations-0.5.12 | lib/mutations/input_filter.rb |
mutations-0.5.11 | lib/mutations/input_filter.rb |
mutations-0.5.10 | lib/mutations/input_filter.rb |