Sha256: a6c22bf34b7b7a2e26fccabd3c0aec5204f2a2c331b41a78995fc7df9ad6edec

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

class Datagrid::Filters::BooleanEnumFilter < Datagrid::Filters::EnumFilter

  YES = "YES"
  NO = "NO"
  VALUES = ActiveSupport::OrderedHash.new
  VALUES[YES] = YES
  VALUES[NO] = NO

  def initialize(report, attribute, options = {}, &block)
    options[:select] = VALUES.keys
    super(report, attribute, options, &block)
  end

  def apply(grid_object, scope, value)
    super(grid_object, scope, to_boolean(value))
  end

  def to_boolean(value)
    VALUES[value]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datagrid-0.6.2 lib/datagrid/filters/boolean_enum_filter.rb
datagrid-0.6.0 lib/datagrid/filters/boolean_enum_filter.rb