lib/powertrack/rules/rule.rb
def valid?
      # reset error
      @error = nil

      validation_rules = [
        :too_long_value?,
        :contains_empty_source?,
        :contains_negated_or?,
        :too_long_tag?,
        :contains_explicit_and?,
        :contains_lowercase_or?,
        :contains_explicit_not?
      ]

      validation_rules.each do |validator|
        # stop when 1 validator fails
        if self.send(validator)
          @error = validator.to_s.gsub(/_/, ' ').gsub(/\?/, '').capitalize
          return false
        end
      end

      true
    end
# Returns true if the rule is valid, false otherwise. The validation error
# can be through the error method.
Returns true if the rule is valid, false otherwise. The validation error
can be through the error method.
Returns true if the rule is valid false otherwise . The validation error can be through the error method .
def valid?
      @error = nil
      validation_rules = [
        :too_long_value?,
        :contains_empty_source?,
        :contains_negated_or?,
        :too_long_tag?,
        :contains_explicit_and?,
        :contains_lowercase_or?,
        :contains_explicit_not?
      ]
      validation_rules.each do |validator|
        if self.send(validator)
          @error = validator.to_s.gsub(/_/, ' ').gsub(/\?/, '').capitalize
          return false
        end
      end
      true
    end
def valid? @error = nil validation_rules = [ :too_long_value? , :contains_empty_source? , :contains_negated_or? , :too_long_tag? , :contains_explicit_and? , :contains_lowercase_or? , :contains_explicit_not? ] validation_rules . each do | validator | if self . send ( validator ) @error = validator . to_s . gsub ( / _ / , ' ' ) . gsub ( / \? / , '' ) . capitalize return false end end true end
Returns true if the rule is valid, false otherwise.
Returns true if the rule is valid false otherwise .
# reset error # stop when 1 validator fails