class SampleModels::Model::Validation

Attributes

config[R]
type[R]

Public Class Methods

new(type, config = {}) click to toggle source
# File lib/sample_models/model.rb, line 96
def initialize(type, config = {})
  @type, @config = type, config
end

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/sample_models/model.rb, line 100
def method_missing(meth, *args, &block)
  type_predicates = %w(
    email_format? inclusion? length? presence? uniqueness?
  )
  if type_predicates.include?(meth.to_s)
    @type == "validates_#{meth.to_s.chop}_of".to_sym
  else
    super
  end
end