<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>codecook (Sinko)</title>
    <link>https://ruby-china.org/codecook</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>代码异常求助。</title>
      <description>&lt;p&gt;实例：&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;Module&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;const_missing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^ASCII_FOR_([A-Z]|[a-z])$/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&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;match&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="no"&gt;NoMethodError&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;end&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="no"&gt;ASCII_FOR_A&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="no"&gt;ASCII_FOR_z&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;结果：
A
z&lt;/p&gt;

&lt;p&gt;教程上说是输出 65 和 122？为什么错误了？谢谢&lt;/p&gt;

&lt;p&gt;另外请教如何排版啊？？TKS&lt;/p&gt;</description>
      <author>codecook</author>
      <pubDate>Wed, 30 Jan 2013 17:30:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/8492</link>
      <guid>https://ruby-china.org/topics/8492</guid>
    </item>
    <item>
      <title>super 报错，麻烦各位帮我看看！</title>
      <description>&lt;p&gt;在做 super 测试时，按照实例修改了一下，结果报错，代码如下：&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;Person&lt;/span&gt;
  &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;  &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="ss"&gt;:age&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="ss"&gt;:sex1&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;say_hello&lt;/span&gt;
     &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&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;Man&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;Person&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;say_sex1&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"i sex is &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sex1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;
    &lt;span class="n"&gt;say_hello&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="n"&gt;man&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Man&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
&lt;span class="n"&gt;man&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"zhangsan"&lt;/span&gt;
&lt;span class="c1"&gt;#man.age= 20&lt;/span&gt;
&lt;span class="n"&gt;man&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sex1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Nan"&lt;/span&gt;
&lt;span class="n"&gt;man&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;say_sex1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;错误：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D:/rubytest/3.14:18:in `say_sex1': super: no superclass method `say_sex1' for #&amp;lt;Man:0x290a420 @name="zhangsan", @age=20, @sex1="Nan"&amp;gt; (NoMethodError)
    from D:/rubytest/3.14:31:in `&amp;lt;main&amp;gt;'
i sex is Nan
[Finished in 0.1s with exit code 1]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;为什么名字输出不了？&lt;/p&gt;</description>
      <author>codecook</author>
      <pubDate>Wed, 30 Jan 2013 11:43:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/8474</link>
      <guid>https://ruby-china.org/topics/8474</guid>
    </item>
    <item>
      <title>Sublime Text 下如何设置默认语法为 Ruby？</title>
      <description>&lt;p&gt;每次新建一个 .rb 文件时，总需要在语法里面改动一下，非常麻烦。有没有办法设置成默认语法，谢谢了&lt;/p&gt;</description>
      <author>codecook</author>
      <pubDate>Thu, 24 Jan 2013 15:58:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/8330</link>
      <guid>https://ruby-china.org/topics/8330</guid>
    </item>
    <item>
      <title>不知道用什么编辑器啊！</title>
      <description>&lt;p&gt;各位好，我是C#转过来学RUBY的，基础还是有点，之前都是用VS和POWERGUI作为编辑器，也用习惯了，最近学习RUBY，想找款好用的编辑器。
下了两款 RUBY 的编辑器，NETBEANS 和 sublime text2，感觉都不是很灵活，请教各位用哪款会比较方便，谢谢！对了，我是在 Windows 环境下操作。&lt;/p&gt;</description>
      <author>codecook</author>
      <pubDate>Mon, 21 Jan 2013 16:50:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/8236</link>
      <guid>https://ruby-china.org/topics/8236</guid>
    </item>
    <item>
      <title>新手学 Ruby 请教个入门问题。</title>
      <description>&lt;p&gt;编辑器我打算用 NETBEANS，按照教程上的去官方下载一个 RUBY 版本的，但是官方没有哪个版本注明支持 RUBY。&lt;a href="http://netbeans.org/downloads/" rel="nofollow" target="_blank"&gt;http://netbeans.org/downloads/&lt;/a&gt;
请教各位我该安装哪个？？&lt;/p&gt;</description>
      <author>codecook</author>
      <pubDate>Fri, 18 Jan 2013 17:16:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/8169</link>
      <guid>https://ruby-china.org/topics/8169</guid>
    </item>
  </channel>
</rss>
