Class: Socket
- Inherits:
-
Object
- Object
- Socket
- Defined in:
- lib/tagen/socket.rb
Class Method Summary collapse
-
.addr(str) ⇒ String
pack human-readable address to Socket address.
-
.unaddr(str) ⇒ String
unpack to humna-readable address from Socket address.
Class Method Details
.addr(str) ⇒ String
pack human-readable address to Socket address
71 72 73 |
# File 'lib/tagen/socket.rb', line 71 def addr(str) str.split(".").map{|v|v.to_i}.pack("CCCC") end |
.unaddr(str) ⇒ String
unpack to humna-readable address from Socket address
82 83 84 |
# File 'lib/tagen/socket.rb', line 82 def unaddr(str) str.unpack("CCCC").join(".") end |