class Mv::Core::Validation::Builder::Base
Attributes
validation[R]
Public Class Methods
new(validation)
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 13 def initialize(validation) @validation = validation end
Protected Instance Methods
apply_allow_blank(stmt)
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 50 def apply_allow_blank stmt "#{stmt} OR LENGTH(TRIM(#{column_reference})) = 0" end
apply_allow_nil(stmt)
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 46 def apply_allow_nil stmt "#{stmt} OR #{column_reference} IS NULL" end
apply_allow_nil_and_blank(stmt)
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 27 def apply_allow_nil_and_blank stmt res = stmt if allow_nil || allow_blank if allow_nil res = apply_allow_nil(res) end if allow_blank res = apply_allow_nil(res) unless allow_nil res = apply_allow_blank(res) end else res = apply_neither_nil_or_blank_allowed(stmt) end res end
apply_neither_nil_or_blank_allowed(stmt)
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 54 def apply_neither_nil_or_blank_allowed stmt "#{column_reference} IS NOT NULL AND #{stmt}" end
column_reference()
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 23 def column_reference column_name end
message()
click to toggle source
# File lib/mv/core/validation/builder/base.rb, line 19 def message validation.full_message end