Class: Unisec::CLI::Commands::Dump::Dec — Documentation by YARD 0.9.44

# Class: Unisec::CLI::Commands::Dump::Dec

Inherits:
  Dry::CLI::Command
  - Object
  - Dry::CLI::Command
  - Unisec::CLI::Commands::Dump::Dec
  show all

Defined in:
  lib/unisec/cli/dump.rb

## Overview

CLI command `unisec dump dec` for the class Decdump from the lib.

Example:

    $ unisec dump dec "noraj"
    UTF-8: 110 111 114 097 106
    UTF-16BE: |000 110| |000 111| |000 114| |000 097| |000 106|
    UTF-16LE: |110 000| |111 000| |114 000| |097 000| |106 000|
    UTF-32BE: |000 000 000 110| |000 000 000 111| |000 000 000 114| |000 000 000 097| |000 000 000 106|
    UTF-32LE: |110 000 000 000| |111 000 000 000| |114 000 000 000| |097 000 000 000| |106 000 000 000|

    $ unisec dump dec "noraj" --enc utf16le
    |110 000| |111 000| |114 000| |097 000| |106 000|

## Instance Method Summary collapse

- #call(input: nil, **options) ⇒ Object

  Decdump of all Unicode encodings.

## Instance Method Details

### #call(input: nil, **options) ⇒ `Object`

Decdump of all Unicode encodings.

Parameters:

- input (`String`) (defaults to: `nil`) —

  Input string to encode

    74
    75
    76
    77
    78
    79
    80
    81
    82
    # File 'lib/unisec/cli/dump.rb', line 74

    def call(input: nil, **options)
      input = $stdin.read.chomp if input == '-'
      if options[:enc].nil?
        puts Unisec::Decdump.new(input).display
      else
        # using send() is safe here thanks to the value whitelist
        puts Unisec::Decdump.send(options[:enc], input)
      end
    end