class Ehpt::Base
Attributes
data[R]
errors[R]
warnings[R]
Public Class Methods
call(*args)
click to toggle source
# File lib/ehpt/base.rb, line 5 def self.call(*args) new(*args).call end
new(*args)
click to toggle source
# File lib/ehpt/base.rb, line 9 def initialize(*args) @data = nil @errors = [] @warnings = [] end
Public Instance Methods
add_error(error)
click to toggle source
# File lib/ehpt/base.rb, line 27 def add_error(error) if error.is_a?(Array) error.each do |err| add_error(err) end else @errors << error end end
add_warning(warning)
click to toggle source
# File lib/ehpt/base.rb, line 37 def add_warning(warning) if warning.is_a?(Array) warning.each do |err| add_warning(err) end else @warnings << warning end end
error?()
click to toggle source
# File lib/ehpt/base.rb, line 19 def error? !success? end
success?()
click to toggle source
# File lib/ehpt/base.rb, line 15 def success? errors.empty? end
warning?()
click to toggle source
# File lib/ehpt/base.rb, line 23 def warning? !warnings.empty? end