Class: RailsAdmin::AbstractModel::StatementBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_admin/abstract_model.rb

Defined Under Namespace

Classes: FilteringDuration

Instance Method Summary collapse

Constructor Details

#initialize(column, type, value, operator) ⇒ StatementBuilder

Returns a new instance of StatementBuilder.



135
136
137
138
139
140
# File 'lib/rails_admin/abstract_model.rb', line 135

def initialize(column, type, value, operator)
  @column = column
  @type = type
  @value = value
  @operator = operator
end

Instance Method Details

#to_statementObject



142
143
144
145
146
147
# File 'lib/rails_admin/abstract_model.rb', line 142

def to_statement
  return if [@operator, @value].any? { |v| v == '_discard' }

  unary_operators[@operator] || unary_operators[@value] ||
    build_statement_for_type_generic
end