Module: By2::Utils
- Defined in:
- lib/by2/utils.rb
Class Method Summary collapse
- .fdate(date) ⇒ Object
- .hex_to_ascii(hex) ⇒ Object
- .int32_to_ip(int32) ⇒ Object
- .ip_to_int32(ip) ⇒ Object
Class Method Details
.fdate(date) ⇒ Object
18 19 20 |
# File 'lib/by2/utils.rb', line 18 def self.fdate(date) date.strftime("%Y-%m-%d") end |
.hex_to_ascii(hex) ⇒ Object
14 15 16 |
# File 'lib/by2/utils.rb', line 14 def self.hex_to_ascii(hex) [hex].pack("H*") end |
.int32_to_ip(int32) ⇒ Object
6 7 8 |
# File 'lib/by2/utils.rb', line 6 def self.int32_to_ip(int32) IPAddr.new(int32, Socket::AF_INET).to_s end |
.ip_to_int32(ip) ⇒ Object
10 11 12 |
# File 'lib/by2/utils.rb', line 10 def self.ip_to_int32(ip) IPAddr.new(ip).to_i end |