【问题标题】:How can I get "thor list" to list methods in ruby class如何获得“雷神列表”以列出 ruby​​ 类中的方法
【发布时间】:2012-03-27 08:53:58
【问题描述】:

我在 thor 中列出我的任务时遇到问题,即使是最简单的程序:

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”方法名称。你能帮帮我吗?

谢谢你,
保罗

【问题讨论】:

    标签: ruby thor


    【解决方案1】:

    只需将 'desc' 行更改为:

    desc "hello", "将 'hello world' 放在控制台上"

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-18
      相关资源
      最近更新 更多