<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>hyanwang (kutan)</title>
    <link>https://ruby-china.org/hyanwang</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>ruby 能否自动生成变量名？</title>
      <description>&lt;p&gt;比如我有一个 array = [“a","b","c"] 然后自动分别生成变量名 a,b,c 的 Hash 或是其他的类？&lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Thu, 26 Jun 2014 14:29:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/20176</link>
      <guid>https://ruby-china.org/topics/20176</guid>
    </item>
    <item>
      <title>rails 中 highstock.js 问题</title>
      <description>&lt;p&gt;我单独访问链接没有 JS 报错，但我从其他页面点链接进去就报 hightcharts 已经定义加载的错误，貌似页面有缓存，但我在开发模式，按理说缓存都关掉的。
具体代码如下：
view:&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% provide(:title, &lt;/span&gt;&lt;span class="s1"&gt;'Change_WC Charts'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"container"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;
&amp;lt;%= include_gon %&amp;gt;
&amp;lt;%= javascript_include_tag 'highstock', cache:true%&amp;gt;
&amp;lt;%= javascript_include_tag 'modules/ex&lt;/span&gt;&lt;span class="n"&gt;porting&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="ss"&gt;:true&lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= javascript_include_tag "dashboard_tzixuns",cache:true %&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;coffeescript:&lt;/p&gt;
&lt;pre class="highlight coffeescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"#container"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="na"&gt;highcharts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'StockChart'&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;
    &lt;span class="na"&gt;rangeSelector&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;inputEnabled&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'#container'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;480&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;selected&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;text&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'CHANGE WC 未分配任务趋势图'&lt;/span&gt;
    &lt;span class="na"&gt;series&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'未分配任务'&lt;/span&gt;
        &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;gon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;报错信息：
Uncaught Highcharts error #16: &lt;a href="http://www.highcharts.com/errors/16" rel="nofollow" target="_blank" title=""&gt;www.highcharts.com/errors/16&lt;/a&gt; highstock.js?body=1:15
Uncaught TypeError: undefined is not a function &lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Wed, 23 Apr 2014 14:19:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/18793</link>
      <guid>https://ruby-china.org/topics/18793</guid>
    </item>
    <item>
      <title>Rails 中 TDD 中的问题</title>
      <description>&lt;p&gt;使用&lt;code&gt;rails generate integration_test static_pages&lt;/code&gt;生成的&lt;code&gt;static_pages_spec.rb&lt;/code&gt;文件，代码中有&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;static_pages_index_path&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但测试的时候提示没有 static_pages_index_path 方法？这个是什么情况？&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;

&lt;span class="no"&gt;Failures&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="no"&gt;StaticPages&lt;/span&gt; &lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="sr"&gt;/static_pages works! (now write some real specs)
     Failure/&lt;/span&gt;&lt;span class="no"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="n"&gt;static_pages_index_path&lt;/span&gt;
     &lt;span class="no"&gt;NameError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
       &lt;span class="n"&gt;undefined&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt; &lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt; &lt;span class="sb"&gt;`static_pages_index_path' for #&amp;lt;RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fba87318050&amp;gt;
     # ./spec/requests/static_pages_spec.rb:7:in `&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="n"&gt;levels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;required&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;

&lt;span class="no"&gt;Finished&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mf"&gt;0.10695&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="n"&gt;examples&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="n"&gt;failure&lt;/span&gt;

&lt;span class="no"&gt;Failed&lt;/span&gt; &lt;span class="ss"&gt;examples:

&lt;/span&gt;&lt;span class="n"&gt;rspec&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;/&lt;/span&gt;&lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;static_pages_spec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rb&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="c1"&gt;# StaticPages GET /static_pages works! (now write some real specs)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>hyanwang</author>
      <pubDate>Wed, 10 Jul 2013 14:47:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/12395</link>
      <guid>https://ruby-china.org/topics/12395</guid>
    </item>
    <item>
      <title>railstutorial.org 需要翻墙？</title>
      <description>&lt;p&gt;一直无法正常访问……&lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Sat, 15 Jun 2013 16:57:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/11740</link>
      <guid>https://ruby-china.org/topics/11740</guid>
    </item>
    <item>
      <title>如何抓页面跳转后的地址 [已解决]</title>
      <description>&lt;p&gt;某个网址，它做了页面跳转去了另个地方，但那个地方 403 无权限访问，我用 open-uri 只能得报错，但却没有 base_uri, 貌似只有 200 的时候才能得到 base_uri，那我怎么在报错的情况下拿到跳转的地址呢？&lt;/p&gt;

&lt;p&gt;再次看了 DOC，解决了，谢谢大家。
    uri = URI(url_link)
    resp=Net::HTTP::Proxy(proxy_ip,proxy_port).get_response(uri)
    puts resp['location']&lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Thu, 25 Apr 2013 22:20:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/10511</link>
      <guid>https://ruby-china.org/topics/10511</guid>
    </item>
    <item>
      <title>关于符号~&gt;</title>
      <description>&lt;p&gt;~&amp;gt; 不知道这个符号代表什么意思，有谁知道吗？&lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Thu, 08 Nov 2012 16:34:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/6617</link>
      <guid>https://ruby-china.org/topics/6617</guid>
    </item>
    <item>
      <title>如何在文件第一行写入？</title>
      <description>&lt;p&gt;想在一个已有的文件里第一行加入东西，不知道怎么加入。
如果用 File.new("filename","w+") 好像会擦掉后面的东西。
求解，谢谢！&lt;/p&gt;</description>
      <author>hyanwang</author>
      <pubDate>Fri, 26 Oct 2012 19:18:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/6346</link>
      <guid>https://ruby-china.org/topics/6346</guid>
    </item>
  </channel>
</rss>
