Created
November 11, 2014 10:59
-
-
Save FlatMapIO/12a63dab4e71a2eeffbc to your computer and use it in GitHub Desktop.
string extends ipable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol IPify | |
(as-ip-array [this] "Take a string convert to InetAddress[]") | |
(as-ip [this] "Take a string convert to InetAddress[] only returh first item")) | |
(extend-type String | |
IPify | |
(as-ip-array [this] | |
(InetAddress/getAllByName this)) | |
(as-ip [this] | |
(first (as-ip-array this)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment