摘要: arr = [1,2,3]1) arr2 = arr.each{|element| element = element * 2} #arr与arr2仍然都等于[1,2,3] each返回原数组 遍历内对元素的更改不会保存2) arr2 = arr.map{|element| element = el... 阅读全文
posted @ 2014-09-04 23:40 juandx 阅读(362) 评论(0) 推荐(0)
摘要: #虚拟网络拓扑的json数据 def topodata #@vnic = Vnic.all #flash.now[:notice] = 'Message sent!' #flash.now[:alert] = 'Message sent!' simple_json = { nodes:... 阅读全文
posted @ 2014-09-04 15:46 juandx 阅读(937) 评论(0) 推荐(0)
摘要: tASSOC means the => operator 阅读全文
posted @ 2014-09-04 12:19 juandx 阅读(139) 评论(0) 推荐(0)
摘要: 实现json、做出提示框1、在controller中使用flash.now[:alert] = "str"方法来做printdef topodata #@vnic = Vnic.all #flash.now[:notice] = 'Message sent!' #flash.now[:aler... 阅读全文
posted @ 2014-09-04 00:25 juandx 阅读(462) 评论(0) 推荐(0)