<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Alexander (__alex__)</title>
    <link>https://ruby-china.org/Alexander</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>"需要登录后回复方可回复"，怎么断句？</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2016/3eaf9e4a0fba381dd51eb6e003cff7cc.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Tue, 19 Jan 2016 18:56:27 +0800</pubDate>
      <link>https://ruby-china.org/topics/28783</link>
      <guid>https://ruby-china.org/topics/28783</guid>
    </item>
    <item>
      <title>在 RubyMine 中, application.js 中的 require 实时提示称找不到文件.</title>
      <description>&lt;p&gt;如题，在 application.js 中的 &lt;code&gt;//= require bootstrap-sprockets&lt;/code&gt; 解析称 "Cannot resolve file bootstrap-sprockets", 但实际上 rails &lt;strong&gt;可以&lt;/strong&gt; 找到这个文件的，因为运行后程序没有报错，并且页面源代码中载入的相关 js.&lt;/p&gt;

&lt;p&gt;请问如何解决这个 resovle 问题。Thx.&lt;/p&gt;

&lt;p&gt;ps. 请不要回复一些类似 "建议不要使用 IDE 之类的内容", 免得变成另一个编辑器 Vs. IDE 的战场。&lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Tue, 01 Jul 2014 14:34:18 +0800</pubDate>
      <link>https://ruby-china.org/topics/20256</link>
      <guid>https://ruby-china.org/topics/20256</guid>
    </item>
    <item>
      <title>[已解决][求助] Scheme 中匿名函数如何接受任意个参数</title>
      <description>&lt;p&gt;使用 &lt;code&gt;define&lt;/code&gt; 时可以这样定义&lt;/p&gt;
&lt;pre class="highlight scheme"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;define&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;func&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如何在匿名函数中定义&lt;/p&gt;
&lt;pre class="highlight scheme"&gt;&lt;code&gt;&lt;span class="c1"&gt;; Error `(lambda ( . args) args)`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;update&lt;/strong&gt;:
方法见 &lt;a href="#reply1" class="at_floor" data-floor="1"&gt;#1 楼&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre class="highlight scheme"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="nv"&gt;args&lt;/span&gt; &lt;span class="nv"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;</description>
      <author>Alexander</author>
      <pubDate>Wed, 12 Mar 2014 08:42:27 +0800</pubDate>
      <link>https://ruby-china.org/topics/17820</link>
      <guid>https://ruby-china.org/topics/17820</guid>
    </item>
    <item>
      <title>从每个数组中选一个，组合成一个新的数组的内建方法。</title>
      <description>&lt;p&gt;请问，实现下面功能的内建方法有吗？&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;combine&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;arrays&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;arrays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="n"&gt;arrays&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
      &lt;span class="n"&gt;combine&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;arrays&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt; &lt;span class="n"&gt;n&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="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;combine&lt;/span&gt; &lt;span class="sx"&gt;%w{a b}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sx"&gt;%w{A B}&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;p&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="c1"&gt;# result&lt;/span&gt;
&lt;span class="c1"&gt;# ["a", "A"]&lt;/span&gt;
&lt;span class="c1"&gt;# ["b", "A“]&lt;/span&gt;
&lt;span class="c1"&gt;# [”a", "B"]&lt;/span&gt;
&lt;span class="c1"&gt;# ["b", "B"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>Alexander</author>
      <pubDate>Thu, 25 Apr 2013 21:14:25 +0800</pubDate>
      <link>https://ruby-china.org/topics/10508</link>
      <guid>https://ruby-china.org/topics/10508</guid>
    </item>
    <item>
      <title>什么时候下一次开卖 Ruby T-Shirt?</title>
      <description>&lt;p&gt;夏天快到了&lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Sun, 17 Mar 2013 23:29:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/9515</link>
      <guid>https://ruby-china.org/topics/9515</guid>
    </item>
    <item>
      <title>Monkey Patch 的作用域</title>
      <description>&lt;p&gt;如这段代码：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;A&lt;/span&gt;
  &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;String&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_by_module_a&lt;/span&gt;
      &lt;span class="s1"&gt;'hello world'&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;/code&gt;&lt;/pre&gt;
&lt;p&gt;我预期只有在 &lt;code&gt;include A&lt;/code&gt; 的作用域里面，&lt;code&gt;String&lt;/code&gt; 才会被扩展，而实际上，却不是如此.
请问要如何实现我的预期呢，还是实现不了？&lt;/p&gt;

&lt;p&gt;btw: 之前好像听闻 Ruby2 有这方面的的打算，但看 What's new 没有发现这个特性呀。还是我记错了。&lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Sat, 09 Mar 2013 21:50:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/9285</link>
      <guid>https://ruby-china.org/topics/9285</guid>
    </item>
    <item>
      <title>Ruby 如何实现类似 Python, Haskell... import 的效果?</title>
      <description>&lt;p&gt;简单说来，就是实现 &lt;code&gt;Python&lt;/code&gt; 中 &lt;code&gt;from Foo import Bar&lt;/code&gt; 的效果，谢谢啦！&lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Sat, 09 Mar 2013 19:01:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/9282</link>
      <guid>https://ruby-china.org/topics/9282</guid>
    </item>
    <item>
      <title>怎么动态地为类添加实例方法？</title>
      <description>&lt;p&gt;比如说有两个类 A 的实例 a1, a2:&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;a1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;A&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;a2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;此时要为 a1, a2 都添加一个方法 m, 该怎么办呢？
除了下面这两种方法：&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;A&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;m&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;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;class_eval&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;m&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>Alexander</author>
      <pubDate>Sun, 08 Apr 2012 19:08:49 +0800</pubDate>
      <link>https://ruby-china.org/topics/2461</link>
      <guid>https://ruby-china.org/topics/2461</guid>
    </item>
    <item>
      <title>给这个节点添个树叶吧</title>
      <description>&lt;p&gt;话说 Erlang 的思想活了，可本身这门语言却没有流行起来。这是为啥呢？  &lt;/p&gt;</description>
      <author>Alexander</author>
      <pubDate>Tue, 06 Mar 2012 22:18:39 +0800</pubDate>
      <link>https://ruby-china.org/topics/1659</link>
      <guid>https://ruby-china.org/topics/1659</guid>
    </item>
  </channel>
</rss>
