Class: Aequitas::Rule::Format::Proc
- Inherits:
-
Aequitas::Rule::Format
- Object
- Aequitas::Rule
- Aequitas::Rule::Format
- Aequitas::Rule::Format::Proc
- Defined in:
- lib/aequitas/rule/format/proc.rb
Constant Summary
Constants inherited from Aequitas::Rule::Format
EMAIL_ADDRESS, FORMATS, FORMAT_MESSAGES, URL
Instance Attribute Summary
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
Methods inherited from Aequitas::Rule::Format
#initialize, rules_for, #violation_type
Methods inherited from Aequitas::Rule
#attribute_value, #execute?, #initialize, rules_for, #skip?, #validate, #violation_data, #violation_info, #violation_values
Methods included from ValueObject
Constructor Details
This class inherits a constructor from Aequitas::Rule::Format
Instance Method Details
#valid?(resource) ⇒ Boolean
10 11 12 13 14 15 16 17 |
# File 'lib/aequitas/rule/format/proc.rb', line 10 def valid?(resource) value = attribute_value(resource) skip?(value) || format.call(value) # rescue ::Encoding::CompatibilityError # # This is to work around a bug in jruby - see formats/email.rb # false end |