lib/music-transcription/validatable.rb in music-transcription-0.7.2 vs lib/music-transcription/validatable.rb in music-transcription-0.7.3
- old
+ new
@@ -3,22 +3,27 @@
module Validatable
attr_reader :errors
def validate
@errors = []
+
@check_methods.each do |check_method|
begin
send(check_method)
rescue StandardError => e
@errors.push e
end
end
- if respond_to?(:validatables)
- validatables.each do |v|
- @errors += v.validate
- end
+
+ validatables.each do |v|
+ @errors += v.validate
end
+
return @errors
+ end
+
+ def validatables
+ []
end
def valid?
self.validate
@errors.empty?