Class: RetroIDL::ASN::INTEGER
- Defined in:
- lib/retro_idl/asn/integer.rb
Overview
X.680 section 19
Constant Summary collapse
- TAG_CLASS_NUMBER =
2
- TAG_CLASS =
:universal
Instance Attribute Summary
Attributes inherited from BaseType
Instance Method Summary collapse
-
#evaluate(value) ⇒ TrueClass, FalseClass
evaluate a native Ruby value against a type definition.
- #evaluateConstraint(value) ⇒ Object
-
#initialize(**opts) ⇒ INTEGER
constructor
A new instance of INTEGER.
-
#link(mod, stack) ⇒ MODULE?
resolve symbols to definitions in module.
-
#to_s ⇒ String
Convert object to ASN.1 syntax representation.
Methods inherited from BaseType
Constructor Details
#initialize(**opts) ⇒ INTEGER
Returns a new instance of INTEGER.
35 36 37 38 39 40 41 |
# File 'lib/retro_idl/asn/integer.rb', line 35 def initialize(**opts) super(**opts) @numberList = nil if opts[:numberList] @numberList = ValueList.new(opts[:numberList], NamedNumber) end end |
Instance Method Details
#evaluate(value) ⇒ TrueClass, FalseClass
Note:
may be called before linking but will raise exception if references to not resolve
evaluate a native Ruby value against a type definition
74 75 76 |
# File 'lib/retro_idl/asn/integer.rb', line 74 def evaluate(value) value.kind_of?(Integer) end |
#evaluateConstraint(value) ⇒ Object
78 79 80 81 82 |
# File 'lib/retro_idl/asn/integer.rb', line 78 def evaluateConstraint(value) if evaluate(value) and ( @constrant.nil? or @constraint.evaluate(value) ) true end end |
#link(mod, stack) ⇒ MODULE?
resolve symbols to definitions in module
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/retro_idl/asn/integer.rb', line 44 def link(mod, stack) if @mod.nil? or @mod != mod @mod = nil if @numberList.nil? or @numberList.link(mod, []) super(mod, stack) end end @mod end |
#to_s ⇒ String
Convert object to ASN.1 syntax representation
63 64 65 66 67 68 69 70 71 |
# File 'lib/retro_idl/asn/integer.rb', line 63 def to_s result = "#{@tag} INTEGER" if @numberList result << @numberList.to_s end result << " #{@constraint}" end |