class YaKassa::V3::Validators::Base
Attributes
error[R]
name[R]
value[R]
Public Class Methods
new(name, value, params = {})
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 7 def initialize(name, value, params = {}) @name = name @value = value @params = params @error = nil @is_validated = false end
Public Instance Methods
valid?()
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 21 def valid? unless @is_validated msg = "#{self.class.name}. Need to run #validate method before call #valid?" Rails.logger.info(msg) return nil end @error.blank? end
validate()
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 15 def validate @error = error_msg unless condition @is_validated = true nil end
Private Instance Methods
condition()
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 36 def condition not_implemented_method end
error_msg()
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 40 def error_msg not_implemented_method end
not_implemented_method()
click to toggle source
# File lib/ya_kassa/v3/validators/base.rb, line 32 def not_implemented_method raise 'Method is not implemented' end