Module: RASN1::Types::Constrained::ClassMethods
- Defined in:
- lib/rasn1/types/constrained.rb
Overview
Define class/module methods for RASN1::Types::Constrained module
Instance Method Summary collapse
-
#check_constraint(value) ⇒ Object
Check constraint, if defined.
-
#constrained? ⇒ Boolean
Check if a constraint is really defined.
-
#constraint=(constraint) ⇒ Proc?
Setter for constraint.
Instance Method Details
#check_constraint(value) ⇒ Object
Check constraint, if defined
28 29 30 31 |
# File 'lib/rasn1/types/constrained.rb', line 28 def check_constraint(value) return unless constrained? raise ConstraintError.new(self) unless @constraint.call(value) end |
#constrained? ⇒ Boolean
Check if a constraint is really defined
21 22 23 |
# File 'lib/rasn1/types/constrained.rb', line 21 def constrained? @constraint.is_a?(Proc) end |
#constraint=(constraint) ⇒ Proc?
Setter for constraint
15 16 17 |
# File 'lib/rasn1/types/constrained.rb', line 15 def constraint=(constraint) @constraint = constraint end |