Class: Jsonoid::Document::Errors
- Inherits:
-
Object
- Object
- Jsonoid::Document::Errors
show all
- Defined in:
- lib/jsonoid/errors.rb
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
4
5
6
|
# File 'lib/jsonoid/errors.rb', line 4
def initialize
clear!
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/jsonoid/errors.rb', line 20
def method_missing(name, *args, &block)
if name =~ /^(any?|empty?|each|map|select|detect|find)/
@errors.send(name, *args, &block)
else
super
end
end
|
Instance Method Details
#add(type, message) ⇒ Object
12
13
14
|
# File 'lib/jsonoid/errors.rb', line 12
def add(type, message)
@errors << [type, message]
end
|
#blank? ⇒ Boolean
8
9
10
|
# File 'lib/jsonoid/errors.rb', line 8
def blank?
@errors.empty?
end
|
#clear! ⇒ Object
16
17
18
|
# File 'lib/jsonoid/errors.rb', line 16
def clear!
@errors = []
end
|