Class: Unidom::Common::Numeration
- Inherits:
-
Object
- Object
- Unidom::Common::Numeration
- Defined in:
- lib/unidom/common/numeration.rb
Overview
Numeration 是数字格式转换的辅助类。
Class Method Summary collapse
Class Method Details
.hex(data) ⇒ Object
6 7 8 |
# File 'lib/unidom/common/numeration.rb', line 6 def self.hex(data) data.present? ? data.unpack('H*')[0] : nil end |
.rev_hex(hex) ⇒ Object
10 11 12 |
# File 'lib/unidom/common/numeration.rb', line 10 def self.rev_hex(hex) hex.present? ? hex.scan(/../).map(&:hex).pack('c*') : nil end |