Module: CBOR_DIAG::Appstring2

Defined in:
lib/cbor-diag-parser.rb

Instance Method Summary collapse

Instance Method Details

#to_rbObject



1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
# File 'lib/cbor-diag-parser.rb', line 1544

def to_rb
  data = s.elements.map(&:partval).join.b
  app = a.text_value
  # Find a better place to put a default initialization
  CBOR_DIAG.const_set(:APPS, Hash.new { |h, k|
    h[k] = begin CBOR_DIAG.const_get("App_#{k.downcase}")
           rescue NameError
             raise ArgumentError.new("cbor-diagnostic: application-oriented extension #{k}'' unknown or not enabled")
           end
  }) unless CBOR_DIAG.const_defined?(:APPS)
  CBOR_DIAG::APPS[app].decode(app, data)
end