Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
yan
@jyfeather
会员
第 7436 位会员 / 2013-06-04

[email protected]
2 篇帖子 / 8 条回帖
0 关注者
0 正在关注
0 收藏
GitHub Public Repos
More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 查看你常用的 10shell 命令? at 2013年06月30日

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

  • Ruby 中怎么替换 setattr (...) at 2013年06月29日

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

  • Ruby 中怎么替换 setattr (...) at 2013年06月29日

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

  • Ruby 中怎么替换 setattr (...) at 2013年06月29日

    不过,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 2013年06月29日

    可是 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 2013年06月29日

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

  • OS X Lion 下死活装不上 mysql 这个 gem at 2013年06月06日

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

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

  • 通过实例学习 Ruby 的一个比较好的网站 at 2013年06月06日

    感谢你的分享

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