<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>guaishushu (怪叔叔)</title>
    <link>https://ruby-china.org/guaishushu</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Ruby 有 随机从序列中选出一个元素的方法么</title>
      <description>&lt;p&gt;类似 Python 的 random.choice&lt;/p&gt;</description>
      <author>guaishushu</author>
      <pubDate>Thu, 02 Aug 2012 12:18:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/4700</link>
      <guid>https://ruby-china.org/topics/4700</guid>
    </item>
    <item>
      <title>ruby 错误</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;ARGV&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Hello &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, how old r u?"&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;gets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chomp&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;
  &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Hi, boy."&lt;/span&gt;
&lt;span class="k"&gt;elsif&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;
  &lt;span class="n"&gt;pus&lt;/span&gt; &lt;span class="s2"&gt;"Hi, the yong man"&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Hello, the old man"&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;第一个问题 为什么 输出 Hello ["ding"], how old r u? 回家 [""] 呢？
然后 ruby 会报错
from ex13.rb:10:in &lt;code&gt;gets'
from ex13.rb:10:in&lt;/code&gt;&lt;/p&gt;'&lt;p&gt;&lt;/p&gt;

&lt;p&gt;我现在看的是 The hard way Exercise 13: Parameters, Unpacking, Variables
我感觉我问的问题太初级了 我是先看 hard way 呢 还是需要买本书系统学习一下
谢谢&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;测试了一下 发现当 ARGV 只有一个变量的时候 会出现 [""], 多个的话就不会出现
还有 ARGV 的时候 gets 会出错
这时为什么呢&lt;/p&gt;</description>
      <author>guaishushu</author>
      <pubDate>Thu, 03 May 2012 07:57:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/3045</link>
      <guid>https://ruby-china.org/topics/3045</guid>
    </item>
    <item>
      <title>gem 和 require 的目录在哪</title>
      <description>&lt;p&gt;都是安装 ruby 的目录下么？
require 一段沒有特別包含 library 的腳本 是什么意思 这里的 libarary 只得是类还是方法呢？
谢谢  &lt;/p&gt;</description>
      <author>guaishushu</author>
      <pubDate>Wed, 02 May 2012 17:40:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/3033</link>
      <guid>https://ruby-china.org/topics/3033</guid>
    </item>
    <item>
      <title>Learn ruby the hard way 第六节 问题</title>
      <description>&lt;p&gt;有一个代码这样写
x = "There are #{10} types of people."
10 为什么要加 #{}呢  &lt;/p&gt;</description>
      <author>guaishushu</author>
      <pubDate>Sun, 29 Apr 2012 19:58:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/2983</link>
      <guid>https://ruby-china.org/topics/2983</guid>
    </item>
    <item>
      <title>ruby 可以骇客么？</title>
      <description>&lt;p&gt;如题~.~
听说都是 python 的多 ruby 把中心都放在 web 了
有骇客方面的库么？   &lt;/p&gt;</description>
      <author>guaishushu</author>
      <pubDate>Tue, 24 Apr 2012 00:59:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/2847</link>
      <guid>https://ruby-china.org/topics/2847</guid>
    </item>
  </channel>
</rss>
