Module: PetoErrorable

Included in:
PetoClass
Defined in:
lib/peto/mixin/peto_errorable.rb

Instance Method Summary collapse

Instance Method Details

#add_error(error) ⇒ Object



6
7
8
# File 'lib/peto/mixin/peto_errorable.rb', line 6

def add_error(error)
  errors << error
end

#errorsObject



2
3
4
# File 'lib/peto/mixin/peto_errorable.rb', line 2

def errors
  @errors ||= []
end

#invalid_type(name, expect, real) ⇒ Object



14
15
16
# File 'lib/peto/mixin/peto_errorable.rb', line 14

def invalid_type(name, expect, real)
  add_error(["invalid type : #{name}.class is expected #{expect}, but was #{real.class}"])
end

#raise_errorsObject



10
11
12
# File 'lib/peto/mixin/peto_errorable.rb', line 10

def raise_errors
  raise errors.join("\n")
end