Class: Aequitas::Rule::PrimitiveType::Virtus
- Inherits:
-
Aequitas::Rule::PrimitiveType
- Object
- Aequitas::Rule
- Aequitas::Rule::PrimitiveType
- Aequitas::Rule::PrimitiveType::Virtus
- Defined in:
- lib/aequitas/rule/primitive_type/virtus.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Attributes inherited from Aequitas::Rule::PrimitiveType
Attributes inherited from Aequitas::Rule
#attribute_name, #custom_message, #guard, #skip_condition
Attributes included from ValueObject
Instance Method Summary collapse
-
#initialize(attribute_name, options = {}) ⇒ Virtus
constructor
A new instance of Virtus.
- #primitive?(value) ⇒ Boolean
Methods inherited from Aequitas::Rule::PrimitiveType
#valid?, #violation_data, #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
#initialize(attribute_name, options = {}) ⇒ Virtus
Returns a new instance of Virtus.
12 13 14 15 16 |
# File 'lib/aequitas/rule/primitive_type/virtus.rb', line 12 def initialize(attribute_name, = {}) @attribute = .fetch(:attribute) super(attribute_name, :primitive => attribute.class.primitive) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
10 11 12 |
# File 'lib/aequitas/rule/primitive_type/virtus.rb', line 10 def attribute @attribute end |
Instance Method Details
#primitive?(value) ⇒ Boolean
18 19 20 |
# File 'lib/aequitas/rule/primitive_type/virtus.rb', line 18 def primitive?(value) attribute.value_coerced?(value) end |