Module: ActiveModel::ErrorCollecting
- Defined in:
- lib/active_model/error_collecting.rb,
lib/active_model/error_collecting/errors.rb,
lib/active_model/error_collecting/reporter.rb,
lib/active_model/error_collecting/emulation.rb,
lib/active_model/error_collecting/error_message.rb,
lib/active_model/error_collecting/hash_reporter.rb,
lib/active_model/error_collecting/array_reporter.rb,
lib/active_model/error_collecting/error_collection.rb,
lib/active_model/error_collecting/message_reporter.rb,
lib/active_model/error_collecting/error_message_set.rb,
lib/active_model/error_collecting/human_hash_reporter.rb,
lib/active_model/error_collecting/human_array_reporter.rb,
lib/active_model/error_collecting/machine_hash_reporter.rb,
lib/active_model/error_collecting/human_message_reporter.rb,
lib/active_model/error_collecting/machine_array_reporter.rb,
lib/active_model/error_collecting/human_message_formatter.rb
Defined Under Namespace
Modules: Emulation
Classes: ArrayReporter, ErrorCollection, ErrorMessage, ErrorMessageSet, Errors, HashReporter, HumanArrayReporter, HumanHashReporter, HumanMessageFormatter, HumanMessageReporter, MachineArrayReporter, MachineHashReporter, MessageReporter, Reporter
Class Method Summary
collapse
Class Method Details
.get_reporter_class(name, reporter) ⇒ Object
38
39
40
41
42
|
# File 'lib/active_model/error_collecting.rb', line 38
def get_reporter_class(name, reporter)
return reporter if reporter.is_a? Class
class_name = "active_model/error_collecting/#{reporter}_#{name}_reporter"
class_name.classify.constantize
end
|
.reporters ⇒ Object
33
34
35
36
|
# File 'lib/active_model/error_collecting.rb', line 33
def reporters
@reporter_maps ||= {}
@reporter_maps.clone
end
|
.set_reporter(name, reporter) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/active_model/error_collecting.rb', line 26
def set_reporter(name, reporter)
name = name.to_s
@reporter_maps ||= {}
return @reporter_maps.delete(name) unless reporter
@reporter_maps[name] = get_reporter_class(name, reporter)
end
|