Class: Lab42::DataClass::Constraints::AttributeSetters::TripleOfAttributeSetter
- Inherits:
-
Object
- Object
- Lab42::DataClass::Constraints::AttributeSetters::TripleOfAttributeSetter
show all
- Includes:
- AttributeSetter
- Defined in:
- lib/lab42/data_class/constraints/attribute_setters/triple_of_attribute_setter.rb
Instance Attribute Summary
#attribute, #constraint, #instance, #return_setter
Instance Method Summary
collapse
Instance Method Details
#first_element(value) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/lab42/data_class/constraints/attribute_setters/triple_of_attribute_setter.rb', line 11
def first_element(value)
constraint.constraint.first.(value) or raise ConstraintError,
"cannot set value #{value} in set(#{attribute}).first_element"
_set_attr!(_value.set_first(value))
end
|
#second_element(value) ⇒ Object
18
19
20
21
22
|
# File 'lib/lab42/data_class/constraints/attribute_setters/triple_of_attribute_setter.rb', line 18
def second_element(value)
constraint.constraint[1].(value) or raise ConstraintError,
"cannot set value #{value} in set(#{attribute}).second_element"
_set_attr!(_value.set_second(value))
end
|
#third_element(value) ⇒ Object
24
25
26
27
28
|
# File 'lib/lab42/data_class/constraints/attribute_setters/triple_of_attribute_setter.rb', line 24
def third_element(value)
constraint.constraint.last.(value) or raise ConstraintError,
"cannot set value #{value} in set(#{attribute}).third_element"
_set_attr!(_value.set_third(value))
end
|