【发布时间】:2015-06-26 07:37:10
【问题描述】:
我想在一个rails项目下做一个batch。
我创建了一个基本批处理模块:
# lib/tasks/batch_base.rb
module Tasks
class BatchBase
def run
# Run something
end
end
end
现在我想用thor做一个批处理。
# lib/tasks/another_batch.rb
require 'thor'
module Tasks
class AnotherBatch < Thor
desc 'test', 'sample'
def hello(name)
# Do something
end
end
end
在这里我想扩展基本批次,但是当我尝试时:
class AnotherBatch < BatchBase < Thor
# or
class AnotherBatch < Thor < BatchBase
它不起作用。错误:
superclass must be a Class (NilClass given) (TypeError)
我该怎么做?
【问题讨论】:
标签: ruby-on-rails thor