class SimpleValidator

nil return is treated as no error

Constants

CANNOT_CONTINUE
IS_MISSING

Public Instance Methods

method_exists(object, method) click to toggle source
# File lib/input_validator.rb, line 137
def method_exists object, method
  begin
    if !object.respond_to? method
      "#{@node_name}\'s method: *#{method}*" + IS_MISSING
    end
  rescue
    nil
  end
end
method_value_not_nil(object, method) click to toggle source
# File lib/input_validator.rb, line 158
def method_value_not_nil object, method
  begin
    value = object.send method
    if value.nil?
      "#{@node_name}\'s *#{method}* value" + IS_MISSING
    end
  rescue
    nil
  end
end
method_value_not_nil_or_empty(object, method) click to toggle source
# File lib/input_validator.rb, line 147
def method_value_not_nil_or_empty object, method
  begin
    value = object.send method
    if value.nil? || value.to_s.strip.length == 0
      "#{@node_name}\'s *#{method}* value is empty or" + IS_MISSING
    end
  rescue
    nil
  end
end