Class: Rulix::Validators::FormatValidator
- Inherits:
-
Object
- Object
- Rulix::Validators::FormatValidator
- Defined in:
- lib/rulix/validators/format_validator.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
- #call(string) ⇒ Object
-
#initialize(options = nil) ⇒ FormatValidator
constructor
A new instance of FormatValidator.
- #to_proc ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ FormatValidator
Returns a new instance of FormatValidator.
6 7 8 9 10 11 |
# File 'lib/rulix/validators/format_validator.rb', line 6 def initialize = nil ||= {} self.format = [:format] self. = .fetch :message, 'does not match format' end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
4 5 6 |
# File 'lib/rulix/validators/format_validator.rb', line 4 def format @format end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/rulix/validators/format_validator.rb', line 4 def end |
Instance Method Details
#call(string) ⇒ Object
13 14 15 |
# File 'lib/rulix/validators/format_validator.rb', line 13 def call string format === string || [false, ] end |
#to_proc ⇒ Object
17 18 19 |
# File 'lib/rulix/validators/format_validator.rb', line 17 def to_proc method(:call) end |