aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1kit/types/choice.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1kit/types/choice.rb')
-rw-r--r--lib/asn1kit/types/choice.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/asn1kit/types/choice.rb b/lib/asn1kit/types/choice.rb
new file mode 100644
index 0000000..04edef4
--- /dev/null
+++ b/lib/asn1kit/types/choice.rb
@@ -0,0 +1,18 @@
+# coding: ASCII-8BIT
+
+class ASN1Kit::Choice < ASN1Kit::Type
+ class << self
+ def [](*alternative_types)
+ # FIXME
+ ret = Class.new(self)
+ hash = alternative_types.to_h
+ ret.const_set(:ALTERNATIVE_TYPES, hash)
+ ret
+ end
+ end
+
+ def to_der
+ @value.to_der
+ # replace tag
+ end
+end