Class: RetroIDL::ASN::BOOLEAN
- Defined in:
- lib/retro_idl/asn/boolean.rb
Overview
Copyright © 2016 Cameron Harper
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Constant Summary collapse
- TAG_CLASS_NUMBER =
1
- TAG_CLASS =
:universal
Instance Attribute Summary
Attributes inherited from BaseType
Instance Method Summary collapse
- #evaluate(value) ⇒ Object
- #evaluateConstraint(value) ⇒ Object
-
#to_s ⇒ String
Convert object to ASN.1 syntax representation.
Methods inherited from BaseType
Constructor Details
This class inherits a constructor from RetroIDL::ASN::BaseType
Instance Method Details
#evaluate(value) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/retro_idl/asn/boolean.rb', line 30 def evaluate(value) if value.class != TrueClass and value.class != FalseClass false else true end end |
#evaluateConstraint(value) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/retro_idl/asn/boolean.rb', line 40 def evaluateConstraint(value) if evaluate(value) and ( @constraint or @constraint.evaluate(value) ) true else false end end |
#to_s ⇒ String
Convert object to ASN.1 syntax representation
26 27 28 |
# File 'lib/retro_idl/asn/boolean.rb', line 26 def to_s "#{@tag} BOOLEAN #{@constraint}" end |