Class: Errapi::Validations::ValidationFactory
- Inherits:
-
Object
- Object
- Errapi::Validations::ValidationFactory
show all
- Defined in:
- lib/errapi/validations.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.build(impl, options = {}) ⇒ Object
44
45
46
47
|
# File 'lib/errapi/validations.rb', line 44
def self.build impl, options = {}
@validation_class = impl
@name = options[:name] || Errapi::Utils.underscore(impl.to_s.sub(/.*::/, '')).to_sym
end
|
.name ⇒ Object
49
50
51
|
# File 'lib/errapi/validations.rb', line 49
def self.name
@name
end
|
.validation_class ⇒ Object
57
58
59
|
# File 'lib/errapi/validations.rb', line 57
def self.validation_class
@validation_class
end
|
Instance Method Details
#config=(config) ⇒ Object
65
66
67
68
|
# File 'lib/errapi/validations.rb', line 65
def config= config
raise "A configuration has already been set for this factory." if @config
@config = config
end
|
#name ⇒ Object
53
54
55
|
# File 'lib/errapi/validations.rb', line 53
def name
self.class.name
end
|
#validation(options = {}) ⇒ Object
70
71
72
|
# File 'lib/errapi/validations.rb', line 70
def validation options = {}
validation_class.new options
end
|
#validation_class ⇒ Object
61
62
63
|
# File 'lib/errapi/validations.rb', line 61
def validation_class
self.class.validation_class
end
|