Class: CBOR_DIAG::App_ip
- Inherits:
-
Object
- Object
- CBOR_DIAG::App_ip
- Defined in:
- lib/cbor-diagnostic-app/ip.rb
Class Method Summary collapse
Class Method Details
.decode(app_prefix, s) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cbor-diagnostic-app/ip.rb', line 5 def self.decode(app_prefix, s) parser = IPGRAMMARParser.new ast = parser.parse(s) if !ast raise ArgumentError, "cbor-diagnostic: Parse Error in ip'#{s}':\n" << EDN.reason(parser, s) end fam, ipv = ast.ast case app_prefix when 'ip' ipv when 'IP' CBOR::Tagged.new(fam, ipv) else fail app_prefix end end |