簡體   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