class Object
Public Class Methods
valid_attributes_pattern?(model_name,attributes)
click to toggle source
# File lib/dbAccessor/updater/updater.rb, line 75 def self.valid_attributes_pattern?(model_name,attributes) keys = attributes.keys values = attributes.values if valid_fixnum_keys?(keys) && valid_values_pattern?(values,model_name) return true end end
valid_fixnum_keys?(keys)
click to toggle source
# File lib/dbAccessor/updater/updater.rb, line 50 def self.valid_fixnum_keys?(keys) keys.each do |k| if !(k.is_a?(Fixnum)) return false break end end return true end
valid_values_pattern?(values,model_name)
click to toggle source
# File lib/dbAccessor/updater/updater.rb, line 60 def self.valid_values_pattern?(values,model_name) values.each do |v| if !(v.nil?) if v.empty? || !(v.is_a?(Hash)) || !valid_object_columns?(model_name,v) || !valid_attributes_values?(v) return false break end else return false break end end return true end
validate(param,waited_keys)
click to toggle source
# File lib/dbAccessor/updater/updater.rb, line 83 def self.validate(param,waited_keys) param.is_a?(Hash) && valid_keys?(param,waited_keys) && is_model?(param[:model_name]) && validate_attributes(param[:attributes]) && !validate_argument(param) end
validate_attributes(given_param)
click to toggle source
# File lib/dbAccessor/updater/updater.rb, line 45 def self.validate_attributes(given_param) given_param.is_a?(Hash) && !given_param.empty? end
validate_id(param)
click to toggle source
# File lib/dbAccessor/reader/reader.rb, line 64 def self.validate_id(param) test_id = lambda do |param| param.each do |i| if !(i.is_a?(Fixnum)) return false break end end return true end param.is_a?(Array) && test_id.call(param) end