Module: CuteHex

Defined in:
lib/cute-hex.rb,
lib/cute-hex/core.rb,
lib/cute-hex/version.rb

Constant Summary collapse

VERSION =
"0.0.4"
@@config =
HashWithIndifferentAccess.new({
  word_size:       32, # bits
  slicer:          :byte,
  pad_zeros:       true,
  debug_mode:      false,
})

Class Method Summary collapse

Class Method Details

.hex_print(_x, **opts) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/cute-hex/core.rb', line 2

def self.hex_print _x, **opts
  slicer = opts[:style] == :data ? (opts[:slicer] || @@config.slicer) : :nibble

  if _x.is_a? Array
    return _x.collect{ |e| stylify(e, slicer, opts) }
  else
    return stylify(_x, slicer, opts)
  end
end

.method_missing(method, *opts) ⇒ Object



29
30
31
32
33
34
# File 'lib/cute-hex.rb', line 29

def self.method_missing(method, *opts)
  case method
  when :config
    return @@config
  end
end