繁体   English   中英

如何获取“ thor list”以列出ruby类中的方法

[英]How can I get “thor list” to list methods in ruby class

即使使用最简单的程序,我也无法列出我的任务:

class Mytest < Thor
  desc "Hello world", "Puts 'hello world' on the console"
  def hello
    puts "Hello world"
  end
end

这是我运行thor list时的控制台输出

$ thor list
mytest
------
thor mytest:world  # Puts 'hello world' on the console

如您所见,输出中省略了“ hello”方法名称。 你能帮我吗?

谢谢,
保罗

只需将“ desc”行更改为:

desc“ hello”,“在控制台上放置'hello world'

希望能帮助到你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM