Class: Compel::Validation::Condition
- Inherits:
-
Object
- Object
- Compel::Validation::Condition
- Defined in:
- lib/compel/validation/conditions/condition.rb
Instance Attribute Summary collapse
-
#option_value ⇒ Object
readonly
Returns the value of attribute option_value.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#value_type ⇒ Object
readonly
Returns the value of attribute value_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value, option_value, options = {}) ⇒ Condition
constructor
A new instance of Condition.
- #validate ⇒ Object
Constructor Details
#initialize(value, option_value, options = {}) ⇒ Condition
Returns a new instance of Condition.
15 16 17 18 19 20 |
# File 'lib/compel/validation/conditions/condition.rb', line 15 def initialize(value, option_value, = {}) @value = value @value_type = .delete(:type) || Coercion::Types::Any @options = @option_value = option_value end |
Instance Attribute Details
#option_value ⇒ Object (readonly)
Returns the value of attribute option_value.
6 7 8 |
# File 'lib/compel/validation/conditions/condition.rb', line 6 def option_value @option_value end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/compel/validation/conditions/condition.rb', line 6 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/compel/validation/conditions/condition.rb', line 6 def value @value end |
#value_type ⇒ Object (readonly)
Returns the value of attribute value_type.
6 7 8 |
# File 'lib/compel/validation/conditions/condition.rb', line 6 def value_type @value_type end |
Class Method Details
.validate(value, option_value, options = {}) ⇒ Object
11 12 13 |
# File 'lib/compel/validation/conditions/condition.rb', line 11 def self.validate(value, option_value, = {}) new(value, option_value, ).validate end |
Instance Method Details
#validate ⇒ Object
22 23 24 25 |
# File 'lib/compel/validation/conditions/condition.rb', line 22 def validate Validation::Result.new \ value, value_type, end |