Class: Trevl::Validator::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/trevl/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



11
12
13
# File 'lib/trevl/validator.rb', line 11

def errors
  @errors
end

#valid?Object

Returns the value of attribute valid?

Returns:

  • (Object)

    the current value of valid?



11
12
13
# File 'lib/trevl/validator.rb', line 11

def valid?
  @valid?
end

Instance Method Details

#to_sObject



12
13
14
15
# File 'lib/trevl/validator.rb', line 12

def to_s
  return "Valid" if valid?
  errors.map { |e| "- #{e}" }.join("\n")
end