Class: Wice::FilterConditionsGeneratorString
- Inherits:
-
FilterConditionsGenerator
- Object
- FilterConditionsGenerator
- Wice::FilterConditionsGeneratorString
- Defined in:
- lib/filter_conditions_generators.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#generate_conditions(opts) ⇒ Object
:nodoc:.
Methods inherited from FilterConditionsGenerator
Constructor Details
This class inherits a constructor from Wice::FilterConditionsGenerator
Instance Method Details
#generate_conditions(opts) ⇒ Object
:nodoc:
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/filter_conditions_generators.rb', line 71 def generate_conditions(opts) #:nodoc: negation = nil if opts.kind_of? String string_fragment = opts elsif (opts.kind_of? Hash) && opts.has_key?(:v) string_fragment = opts[:v] #negation = opts[:n] == '1' ? 'NOT' : '' else Wice.log "invalid parameters for the grid string filter - must be a string: #{opts.inspect} or a Hash with keys :v and :n" return false end if string_fragment.empty? Wice.log "invalid parameters for the grid string filter - empty string" return false end @criteria.where(@field.name.to_s => /#{string_fragment}/) return true end |