<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>wzhang1987 (KKKOOO)</title>
    <link>https://ruby-china.org/wzhang1987</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>求助关于 sublime text 3 中 gets () 的问题</title>
      <description>&lt;p&gt;请教各位大侠，在 ubuntu 的 sublime text 3 中下面代码：&lt;/p&gt;

&lt;p&gt;print("Please input your name:")&lt;br&gt;
name = gets()  #gets.chop()
puts "hello #{name}".upcase&lt;/p&gt;

&lt;p&gt;在 ctrl+b 执行时为什么会直接显示如下结果：&lt;/p&gt;

&lt;p&gt;Please input your name:HELLO &lt;/p&gt;

&lt;p&gt;而不会像 irb 里面一样能让键盘的输入，比如 world 后生成如下结果：&lt;/p&gt;

&lt;p&gt;Please input your name:HELLO WORLD&lt;/p&gt;

&lt;p&gt;即没有控制台的输入过程？无法将键盘输入传入参数。&lt;/p&gt;

&lt;p&gt;是有什么东东我没有设置吗？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Fri, 09 May 2014 17:11:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/19131</link>
      <guid>https://ruby-china.org/topics/19131</guid>
    </item>
    <item>
      <title>there is something wrong with the install,please tell me how to fix it,thanks!</title>
      <description>&lt;p&gt;i read the wiki and follow it,then i use the rvm to install ruby 2.0.0&lt;/p&gt;

&lt;p&gt;during the install it shows:&lt;/p&gt;

&lt;p&gt;Error running '__rvm_patch -F 25 -p1 -N -f -i /home/good/.rvm/patches/ruby/libyaml015.patch',
showing last 15 lines of /home/good/.rvm/log/1393429325_ruby-2.0.0-p451/patch.apply.libyaml015.log
patching file ext/psych/yaml/scanner.c
Hunk #1 FAILED at 615.
Hunk #2 FAILED at 1103.
Hunk #3 succeeded at 1181 with fuzz 2 (offset 5 lines).
Hunk #4 FAILED at 1211.
Hunk #5 succeeded at 1236 with fuzz 3 (offset 5 lines).
Hunk #6 FAILED at 1264.
Hunk #7 FAILED at 2584.
5 out of 7 hunks FAILED -- saving rejects to file ext/psych/yaml/scanner.c.rej
patching file ext/psych/yaml/yaml_private.h
Hunk #1 succeeded at 7 with fuzz 3.
Hunk #2 succeeded at 453 with fuzz 2 (offset 21 lines).
patching file ext/psych/yaml/config.h
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ext/psych/yaml/config.h.rej&lt;/p&gt;

&lt;p&gt;-------------------------------------then it may be ok,but i dont't know :--------------------------------&lt;/p&gt;

&lt;p&gt;ruby-2.0.0-p451 - #applying patch /home/good/.rvm/patches/ruby/GH-488.patch.
ruby-2.0.0-p451 - #configuring..................................................
ruby-2.0.0-p451 - #post-configuration.
ruby-2.0.0-p451 - #compiling............................................................................
ruby-2.0.0-p451 - #installing.............................
ruby-2.0.0-p451 - #making binaries executable.
ruby-2.0.0-p451 - #downloading rubygems-2.2.2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  404k  100  404k    0     0  51090      0  0:00:08  0:00:08 --:--:-- 69427
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.0.0-p451 - #extracting rubygems-2.2.2.
ruby-2.0.0-p451 - #removing old rubygems.
ruby-2.0.0-p451 - #installing rubygems-2.2.2..............
ruby-2.0.0-p451 - #gemset created /home/good/.rvm/gems/ruby-2.0.0-p451@global
ruby-2.0.0-p451 - #importing gemset /home/good/.rvm/gemsets/global.gems.....
ruby-2.0.0-p451 - #generating global wrappers.
ruby-2.0.0-p451 - #gemset created /home/good/.rvm/gems/ruby-2.0.0-p451
ruby-2.0.0-p451 - #importing gemsetfile /home/good/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.0.0-p451 - #generating default wrappers.
ruby-2.0.0-p451 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.0.0-p451 - #complete 
Please be aware that you just installed a ruby that requires 2 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri&lt;/p&gt;

&lt;p&gt;-------------is that something wrong???&lt;/p&gt;

&lt;p&gt;by the way,i don't want to use english,but i haven't chinese input method......&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Wed, 26 Feb 2014 23:56:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/17514</link>
      <guid>https://ruby-china.org/topics/17514</guid>
    </item>
    <item>
      <title>请问以下 ruby 和 gem 的安装有没有问题？</title>
      <description>&lt;p&gt;ubuntu 11.10&lt;/p&gt;

&lt;p&gt;~$ gem source -a &lt;a href="http://ruby.taobao.org" rel="nofollow" target="_blank"&gt;http://ruby.taobao.org&lt;/a&gt;
这个命令后出现如下返回：&lt;/p&gt;

&lt;p&gt;ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in &lt;code&gt;require': cannot load such file -- zlib (LoadError)  from 
ruby-1.9.3-p374/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in&lt;/code&gt;require'&lt;/p&gt;

&lt;p&gt;同样的问题还有：rb:540:in &lt;code&gt;gunzip'
                          rb:239:in&lt;/code&gt;fetch_path'
                          rb:269:in `load_specs‘等等
ruby 版本是这个
~$ ruby -v
ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]&lt;/p&gt;

&lt;p&gt;&lt;a href="/ubuntu" class="user-mention" title="@ubuntu"&gt;&lt;i&gt;@&lt;/i&gt;ubuntu&lt;/a&gt;:~$ gem -v
1.8.25&lt;/p&gt;

&lt;p&gt;&lt;a href="/ubuntu" class="user-mention" title="@ubuntu"&gt;&lt;i&gt;@&lt;/i&gt;ubuntu&lt;/a&gt;:~$ rvm -v&lt;/p&gt;

&lt;p&gt;rvm 1.18.5 (stable) by Wayne E. Seguin wayneeseguin@gmail.com, Michal Papis mpapis@gmail.com [&lt;a href="https://rvm.io/" rel="nofollow" target="_blank"&gt;https://rvm.io/&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;请问我的安装有问题吗？
需要怎么修正？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Sun, 03 Feb 2013 15:35:04 +0800</pubDate>
      <link>https://ruby-china.org/topics/8580</link>
      <guid>https://ruby-china.org/topics/8580</guid>
    </item>
    <item>
      <title>ruby 中有 Mixin 这个概念吗？</title>
      <description>&lt;p&gt;谁能简单说说这种思考的方法？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Wed, 30 Jan 2013 16:01:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/8487</link>
      <guid>https://ruby-china.org/topics/8487</guid>
    </item>
    <item>
      <title>请问 rails 在哪个平台下学习比较好？</title>
      <description>&lt;p&gt;准备学习 ruby on rails 请问在 windows 下学习还是 liunx 下学习比较好？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Fri, 18 Jan 2013 14:29:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/8164</link>
      <guid>https://ruby-china.org/topics/8164</guid>
    </item>
    <item>
      <title>请问 P 这个方法的讲解哪里有？</title>
      <description>&lt;p&gt;p( [ anObject ]+ ) -&amp;gt; nil
For each object, directly writes anObject.inspect followed by the current output record separator to the program's standard output. p bypasses the Ruby I/O libraries.
p self
produces:
main&lt;/p&gt;

&lt;p&gt;除了以上的有更详细的方法讲解吗？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Fri, 18 Jan 2013 13:13:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/8162</link>
      <guid>https://ruby-china.org/topics/8162</guid>
    </item>
    <item>
      <title>类别可以复写吗？</title>
      <description>&lt;p&gt;ruby 里面方法可以复写。&lt;/p&gt;

&lt;p&gt;那么类别呢？以下一类有 3 个方法，我写到 3 个相同类里面效果是一样的吗？
如果创建了实例只要是同名类别的方法都能用吗？&lt;/p&gt;

&lt;p&gt;1.&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Fruit&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;kind&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="vi"&gt;@kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;kind&lt;/span&gt;
    &lt;span class="vi"&gt;@kind&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;inspect&lt;/span&gt;
    &lt;span class="s2"&gt;"a fruit of the &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="vi"&gt;@kind&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; variety"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;2. &lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Fruit&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;kind&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="vi"&gt;@kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Fruit&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;kind&lt;/span&gt;
    &lt;span class="vi"&gt;@kind&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Fruit&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;inspect&lt;/span&gt;
    &lt;span class="s2"&gt;"a fruit of the &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="vi"&gt;@kind&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; variety"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Thu, 17 Jan 2013 17:59:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/8143</link>
      <guid>https://ruby-china.org/topics/8143</guid>
    </item>
    <item>
      <title>这个代表什么？</title>
      <description>&lt;p&gt;#&lt;a rel="nofollow" target="_blank"&gt;Proc:0x02bd4d84&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;请问以上输出信息代表什么？
1.是进程吗？
2.是进程的地址吗？
3.该地址可以记录多个数据吗？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Thu, 17 Jan 2013 11:17:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/8131</link>
      <guid>https://ruby-china.org/topics/8131</guid>
    </item>
    <item>
      <title>简单定义求解释</title>
      <description>&lt;p&gt;def box
contents = nil
get = Proc.new {contents}
set = Proc.new {|n| contents = n}
return get, set
end&lt;/p&gt;

&lt;p&gt;请问以上定义 BOX 里面 get 和 set 分别是什么作用，如果 return 里面 get 和 set 顺序对调会产生什么变化呢？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Tue, 15 Jan 2013 20:19:13 +0800</pubDate>
      <link>https://ruby-china.org/topics/8096</link>
      <guid>https://ruby-china.org/topics/8096</guid>
    </item>
    <item>
      <title>请教变量共享问题</title>
      <description>&lt;p&gt;def box
      contents = nil
      get = Proc.new {contents}
      set = Proc.new {|n| contents = n}
      return get, set
    end&lt;/p&gt;

&lt;p&gt;reader, writer = box
puts reader.call               #nil
puts writer.call(2)            #2
puts reader.call              #2&lt;/p&gt;

&lt;p&gt;上面 box 里面为什么要弄个 get 呢？如果 get 和 set 对调下位置下面输出全是 nil？可是如果改成下面这样又有问题：&lt;/p&gt;

&lt;p&gt;def box
      contents = nil
      #get = Proc.new {contents}
      set = Proc.new {|n| contents = n}
      return set
    end&lt;/p&gt;

&lt;p&gt;reader, writer = box
puts reader.call               #nil
puts writer.call(2)            #warning: multiple values for a block parameter (0 for 1)
puts  reader.call             #undefined method `call' for nil:NilClass (NoMethodError)&lt;/p&gt;

&lt;p&gt;3 个问题求解&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Tue, 15 Jan 2013 18:05:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/8093</link>
      <guid>https://ruby-china.org/topics/8093</guid>
    </item>
    <item>
      <title>请问 trap 是如何使用的？能给个简单的例子最好了！</title>
      <description>&lt;p&gt;x = “AA”&lt;/p&gt;

&lt;p&gt;puts x&lt;/p&gt;

&lt;p&gt;trap ("AA") {puts "get"}
x.trap ("AA") {puts "get"}&lt;/p&gt;

&lt;p&gt;#以上 2 种方式都不行，提示 unsupported signal SIGAA (ArgumentError)
请教各位大侠如何使用 trap？&lt;/p&gt;</description>
      <author>wzhang1987</author>
      <pubDate>Tue, 15 Jan 2013 15:50:37 +0800</pubDate>
      <link>https://ruby-china.org/topics/8089</link>
      <guid>https://ruby-china.org/topics/8089</guid>
    </item>
  </channel>
</rss>
