Class: CabezaDeTermo::ValidationMessages::Library
- Inherits:
-
Object
- Object
- CabezaDeTermo::ValidationMessages::Library
- Defined in:
- lib/validation-messages/library.rb
Class Method Summary collapse
Instance Method Summary collapse
- #configure(&block) ⇒ Object
-
#initialize(&block) ⇒ Library
constructor
A new instance of Library.
- #message_at(validation_name, &block) ⇒ Object
- #message_block_for(validation_name) ⇒ Object
- #message_for(error) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Library
Returns a new instance of Library.
10 11 12 |
# File 'lib/validation-messages/library.rb', line 10 def initialize(&block) configure(&block) unless block.nil? end |
Class Method Details
.default(library = nil) ⇒ Object
3 4 5 6 |
# File 'lib/validation-messages/library.rb', line 3 def self.default(library = nil) @default_library = library unless library.nil? @default_library end |
Instance Method Details
#configure(&block) ⇒ Object
14 15 16 |
# File 'lib/validation-messages/library.rb', line 14 def configure(&block) LibraryConfigurationDSL.evaluate_on(self, &block) end |
#message_at(validation_name, &block) ⇒ Object
18 19 20 |
# File 'lib/validation-messages/library.rb', line 18 def (validation_name, &block) [validation_name] = block end |
#message_block_for(validation_name) ⇒ Object
22 23 24 |
# File 'lib/validation-messages/library.rb', line 22 def (validation_name) .fetch(validation_name) end |
#message_for(error) ⇒ Object
26 27 28 |
# File 'lib/validation-messages/library.rb', line 26 def (error) (error.validation).call(error) end |