Class: RASN1::Types::Enumerated
- Defined in:
- lib/rasn1/types/enumerated.rb
Overview
ASN.1 Enumerated
An ENUMERATED type permits to assign names to integer values. Integer may also be enumerated, but the tag ID is different.
A EnumeratedError is raised when set value is not in enumeration.
Constant Summary collapse
- ID =
Enumerated id value
0x0a
Constants inherited from Primitive
Constants inherited from Base
Base::CLASSES, Base::CLASS_MASK, Base::INDEFINITE_LENGTH, Base::MULTI_OCTETS_ID
Instance Attribute Summary collapse
Attributes inherited from Base
#asn1_class, #default, #name, #options
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Enumerated
constructor
A new instance of Enumerated.
- #to_h ⇒ Hash
Methods inherited from Integer
#der_to_value, #to_i, #value=, #void_value
Methods inherited from Base
#==, #can_build?, constrained?, #constructed?, #der_to_value, #do_parse, #do_parse_explicit, #do_parse_explicit_with_tracing, #do_parse_with_tracing, encoded_type, #explicit?, #id, #implicit?, #initialize_copy, #inspect, #optional?, parse, #parse!, #primitive?, #specific_initializer, start_tracing, stop_tracing, #tagged?, #to_der, #trace, #type, type, #value, #value=, #value?, #value_size, #void_value
Constructor Details
#initialize(options = {}) ⇒ Enumerated
Returns a new instance of Enumerated.
40 41 42 43 |
# File 'lib/rasn1/types/enumerated.rb', line 40 def initialize(={}) super raise EnumeratedError, 'no enumeration given' if @enum.empty? end |
Instance Attribute Details
#enum ⇒ Hash
|
|
# File 'lib/rasn1/types/enumerated.rb', line 29
|
Instance Method Details
#to_h ⇒ Hash
46 47 48 |
# File 'lib/rasn1/types/enumerated.rb', line 46 def to_h @enum end |