Sha256: 3fd9243520e38f3bb565f92b26c7b98d1e8b04816c046b020dcd0cd23cf6d4a1

Contents?: true

Size: 671 Bytes

Versions: 9

Compression:

Stored size: 671 Bytes

Contents

module ForestLiana
  class OperatorValueParser

    def self.parse(value)
      operator = nil

      if value.first == '!'
        operator = '!='
        value.slice!(0)
      elsif value.first == '>'
        operator = '>'
        value.slice!(0)
      elsif value.first == '<'
        operator = '<'
        value.slice!(0)
      elsif value.include?('*')
        operator = 'ILIKE'
        value.gsub!('*', '%')
      elsif value === '$present'
        operator = 'IS NOT NULL'
        value = nil
      elsif value === '$blank'
        operator = 'IS NULL'
        value = nil
      else
        operator = '='
      end

      [operator, value]
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
forest_liana-1.1.17 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.16 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.15 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.14 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.13 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.12 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.11 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.10 app/services/forest_liana/operator_value_parser.rb
forest_liana-1.1.8 app/services/forest_liana/operator_value_parser.rb