class FilterLexer::Filter

Public Instance Methods

to_arel(arel_table) click to toggle source

Converts a FilterLexer::Filter to an arel node

# File lib/queryfy/filter_lexer/formatter.rb, line 5
def to_arel(arel_table)
        # Get the elements we want to operate on
        field = elements[0].text_value
        operator_method = elements[1].to_arel
        val = elements[2].text_value

        field = Queryfy.get_arel_field(arel_table, field)

        ast_node = arel_table[field.to_sym]

        # Build an arel node from the resolved operator, value and field
        return ast_node.send(operator_method, val)
end