Class: CBOR_DIAG::App_h
- Inherits:
-
Object
- Object
- CBOR_DIAG::App_h
- Defined in:
- lib/cbor-diagnostic-app/h.rb
Class Method Summary collapse
Class Method Details
.decode(_, s) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cbor-diagnostic-app/h.rb', line 6 def self.decode(_, s) content = s.split(/([.][.][.])/).map { |s| if s == "..." CBOR::Tagged.new(888, nil) else xeh_string(s) if s != "" end }.compact CBOR::Tagged.new(888, content) end |
.xeh_string(s) ⇒ Object
2 3 4 |
# File 'lib/cbor-diagnostic-app/h.rb', line 2 def self.xeh_string(s) s.gsub(/\s/, "").chars.each_slice(2).map{ |x| Integer(x.join, 16).chr("BINARY") }.join end |