Sha256: 5e1d2e3de66bd2b3286c12810fbd28894bc996826ff86855aff3bd7f63ddf2a1
Contents?: true
Size: 669 Bytes
Versions: 4
Compression:
Stored size: 669 Bytes
Contents
class Datagrid::Filters::EnumFilter < Datagrid::Filters::BaseFilter def initialize(*args) super(*args) raise Datagrid::ConfigurationError, ":select option not specified" unless options[:select] end def format(value) return nil if self.strict && !select.include?(value) value end def select option = self.options[:select] option.respond_to?(:call) ? option.call : option end def include_blank self.options.has_key?(:include_blank) ? options[:include_blank] : true unless self.prompt end def prompt self.options.has_key?(:prompt) ? options[:prompt] : false end def strict self.options[:strict] end end
Version data entries
4 entries across 4 versions & 1 rubygems