Class: Aequitas::Rule::Format::Regexp
- Inherits:
-
Aequitas::Rule::Format
- Object
- Aequitas::Rule
- Aequitas::Rule::Format
- Aequitas::Rule::Format::Regexp
- Defined in:
- lib/aequitas/rule/format/regexp.rb
Constant Summary
Constant Summary
Constants inherited from Aequitas::Rule::Format
EMAIL_ADDRESS, FORMATS, FORMAT_MESSAGES, URL
Instance Attribute Summary (collapse)
-
- (Object) format_name
readonly
Returns the value of attribute format_name.
Attributes inherited from Aequitas::Rule::Format
Attributes inherited from Aequitas::Rule
#attribute_name, #custom_message, #guard, #skip_condition
Attributes included from ValueObject
Instance Method Summary (collapse)
- - (Boolean) expected_format?(value)
-
- (Regexp) initialize(attribute_name, options = {})
constructor
A new instance of Regexp.
Methods inherited from Aequitas::Rule::Format
rules_for, #valid_value?, #violation_type
Methods inherited from Aequitas::Rule
#attribute_value, #execute?, rules_for, #skip?, #validate, #violation_data, #violation_info, #violation_values
Methods included from ValueObject
Constructor Details
- (Regexp) initialize(attribute_name, options = {})
A new instance of Regexp
14 15 16 17 18 |
# File 'lib/aequitas/rule/format/regexp.rb', line 14 def initialize(attribute_name, = {}) super @format_name = .fetch(:format_name, nil) end |
Instance Attribute Details
- (Object) format_name (readonly)
Returns the value of attribute format_name
12 13 14 |
# File 'lib/aequitas/rule/format/regexp.rb', line 12 def format_name @format_name end |
Instance Method Details
- (Boolean) expected_format?(value)
20 21 22 |
# File 'lib/aequitas/rule/format/regexp.rb', line 20 def expected_format?(value) value ? value.to_s =~ self.format : false end |