Module: Nibbler::DataProcessor

Extended by:
DataProcessor
Included in:
DataProcessor
Defined in:
lib/nibbler/data_processor.rb

Overview

Accepts various types of input and returns an array of hex digit chars

Ideally this would output Integer objects. However, given that Ruby numerics 0x0 and 0x00 result in the same object (0 Integer), this would limit the parser to only working with bytes instead of both nibbles and bytes.

For example, if the input were “5” then the processor would return an ambiguous 0x5

Instance Method Summary collapse

Instance Method Details

#process(*args) ⇒ Array<String>

Accepts various types of input and returns an array of hex digit chars Invalid input is disregarded

Parameters:

  • args (*String, *Integer)

Returns:

  • (Array<String>)

    An array of hex string nibbles eg “6”, “a”



19
20
21
# File 'lib/nibbler/data_processor.rb', line 19

def process(*args)
  args.map { |arg| convert(arg) }.flatten.compact.map(&:upcase)
end