Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
yan
@jyfeather
Member
NO. 7436 / 2013-06-04

[email protected]
2 Topics / 8 Replies
0 Followers
0 Following
0 Favorites
GitHub Public Repos
More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 查看你常用的 10shell 命令? at June 30, 2013

    107 ruby 92 ls 72 cd 59 vim 34 git 12 ll 10 cp 9 clear 8 touch 8 mv

  • Ruby 中怎么替换 setattr (...) at June 29, 2013

    #7 楼 @Rei 嗯,有点明白了。😄

  • Ruby 中怎么替换 setattr (...) at June 29, 2013

    #3 楼 @luikore require 'ostruct'也很好用哈,谢谢你~

  • Ruby 中怎么替换 setattr (...) at June 29, 2013

    不过,obj.instance_variable_set("@instance_variable", value)的确可以诶,@blacktulip ,就是代码量略多。

    1 class Test 2 | # test class 3 end 4 5 t = Test.new 6 t.instance_variable_set("@a", 100) 7 puts t.instance_variable_get("@a")

    非常感谢帮助哟。

  • Ruby 中怎么替换 setattr (...) at June 29, 2013

    可是 python 的对象中并不需要事先申明变量,也能用setattr()动态添加,比如这样

    1 class test(object): 2 | """test class""" 3 4 t = test() 5 setattr(t, 'a', 100) 6 print t.a

    而 Ruby 中的send方法,好像只能对已经定义的方法进行修改。

    不知道小弟说的正确不?

  • Ruby 中怎么替换 setattr (...) at June 29, 2013

    好像是用object.send(symbol, arg)吗,对吗?

  • OS X Lion 下死活装不上 mysql 这个 gem at June 06, 2013

    我的也是这个问题,真是啃爹呀

    本来不甘心卸了重装,看到你的帖子,我也决定重头来一波啦

  • 通过实例学习 Ruby 的一个比较好的网站 at June 06, 2013

    感谢你的分享

关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English