class Viator

Easy and Clean Error Handler

Constants

VERSION

Attributes

errors[R]
hide_value[RW]
value[W]

Public Class Methods

new(options = {}) click to toggle source
# File lib/viator.rb, line 12
def initialize(options = {})
  @errors     = Errors.new
  @value      = nil
  @hide_value = (options[:hide_value] != false)
end

Public Instance Methods

count() click to toggle source
# File lib/viator.rb, line 30
def count
  @errors.length
end
failure?() click to toggle source
# File lib/viator.rb, line 22
def failure?
  !success?
end
report(str) click to toggle source
# File lib/viator.rb, line 26
def report(str)
  @errors.push(str)
end
reset() click to toggle source
# File lib/viator.rb, line 34
def reset
  @errors = []
end
success?() click to toggle source
# File lib/viator.rb, line 18
def success?
  @errors.length.zero?
end
value() click to toggle source
# File lib/viator.rb, line 38
def value
  @value unless failure? && @hide_value
end