class DatxRuby::Util

工具

Public Class Methods

bytes2long(four, three, two, one) click to toggle source
# File lib/datx_ruby/util.rb, line 12
def bytes2long(four, three, two, one)
  four = check_code(four, 24)
  three = check_code(three, 16)
  two = check_code(two, 8)
  one = check_code(one, 0)
  four | three | two | one
end
check_code(content, num) click to toggle source
# File lib/datx_ruby/util.rb, line 20
def check_code(content, num)
  content.unpack("C*")[0] << num
end
ip2long(ip) click to toggle source
# File lib/datx_ruby/util.rb, line 8
def ip2long(ip)
  ::IPAddr.new(ip).to_i
end