原创 我的友情鏈接
51CTO博客開發
原创 Ruby中查看類的祖先鏈
MyClass.ancestors # => [MyClass, Object, Kernel, BasicObject]
原创 我的友情鏈接
51CTO博客開發
原创 Rails中的日期計算
current_time = Time.now # => 2012-08-24 current_time + 2.year # => 2014-08-24 current_time - 5.month # => 2012-03-24 c
原创 Ruby中動態調用方法與動態定義方法
class MyClass define_method :some_method do |args| "Hello #{args}" end end myClass = MyClass.new myClass.send