Class: Unidom::Common::Numeration

Inherits:
Object
  • Object
show all
Defined in:
lib/unidom/common/numeration.rb

Class Method Summary collapse

Class Method Details

.hex(data) ⇒ Object



3
4
5
# File 'lib/unidom/common/numeration.rb', line 3

def self.hex(data)
  data.present? ? data.unpack('H*')[0] : nil
end

.rev_hex(hex) ⇒ Object



7
8
9
# File 'lib/unidom/common/numeration.rb', line 7

def self.rev_hex(hex)
  hex.present? ? hex.scan(/../).map(&:hex).pack('c*') : nil
end