# encoding: utf-8 # Numeric class Numeric # return is digit html table # # ==== Examples # # 255 to 256 case # # Numeric.to_digit_html_table(255, 256) # # result # #
10digit | #2digit | #8digit | #16digit | #
---|---|---|---|
255 | #0000000011111111 | #377 | #00ff | #
256 | #0000000100000000 | #400 | #0100 | #
10digit | \n2digit | \n8digit | \n16digit | \n
---|---|---|---|
#{i} | \n#{i.to_s(2).rjust(binary_pad, '0')} | \n#{i.to_s(8).rjust(oct_size, '0')} | \n#{i.to_s(16).rjust(hex_pad, '0')} | \n