打印时从数组中删除引号和括号(不能使用put)

时间:2016-11-04 03:49:16

标签: ruby

我有这个:

[1] pry(main)> ip = ["123.456.789.666"]
=> ["123.456.789.666"]

[2] pry(main)> p ip
["123.456.789.666"]
=> ["123.456.789.666"]

我如何得到它以便它出来123.456.789.666?最终目标是采取我的阵列中的任何IP来ping。 ping失败,因为它正在ping“123.456.789.666”。

1 个答案:

答案 0 :(得分:0)

您只能将IP作为字符串或IPAddr对象传递(但通常它将是<nav class="navbar navbar-default navbar-static-top"> <!-- color, statisch--> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse "> <!-- button, navbar mit dropmenu wenn bildschirm zu klein--> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <!-- creates 3 lines in the toggle navigation when screen too little --> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php">TAIL <!-- <span class="glyphicon glyphicon-home" id="homeIcon"></span> --> </a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-left"> <li> <a href="templates.php">Templates</a> </li> <li> <a href="pricing.php">Pricing</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li> <a href="register.php">Sign Up <span class="glyphicon glyphicon-user" id="userIcon"></span> </a> </li> <li> <a href="login.php">Log In <span class="glyphicon glyphicon-log-in" id="logIcon"></span> </a> </li> </ul> </div> </div> </nav> gem的字符串)。当主机指定为IP时,看起来这个gem存在一些问题。

如果您需要检查服务器的可用性 - 请使用系统net/ping

ping