Sha256: 6c57518f4cd6b76bd51977817fad57532713684aeaa889421cecf1f20a4233f0
Contents?: true
Size: 659 Bytes
Versions: 7
Compression:
Stored size: 659 Bytes
Contents
class Datagrid::Filters::EnumFilter < Datagrid::Filters::BaseFilter def initialize(*args) super(*args) raise Datagrid::ConfigurationError, ":select option not specified" unless 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
7 entries across 7 versions & 1 rubygems