【发布时间】:2019-06-28 00:12:14
【问题描述】:
我正在尝试使用 ruport 创建报告,但出现错误。
in '<top (required)>': uninitialized constant Ruport::Report (NameError) Did you mean? Ruport
我使用了https://www.rubydoc.info/github/ruport/ruport-util/Ruport/Report的示例代码
我在 TestExeReport 类中有上述代码
在我的主要课程中,我有这个:
require_relative '../../spec/support/testExeReport'
我已经安装了 gem。
我尝试寻求有关该错误消息的帮助,但没有解决我的问题。
require "rubygems"
require "ruport"
class TestExeReport < Ruport::Report
renders_as_grouping(:style => :inline)
def renderable_data(format)
table = Table("foo.csv")
Grouping(table, :by => "username")
end
end
report = TestExeReport.new
report.save_as("bar.pdf")
我想查看我的“csv”文件的“pdf”报告
提前致谢!
赛蒙。
【问题讨论】:
-
我不知道根本原因,但在加载他们的示例时我看到了同样的问题。我会看看我是否能找出原因和解决方法,但希望你知道这不仅仅是你
-
运行该命令(ruby -e "require 'ruport'; puts Ruport::VERSION" )并检查它是否安装正确......
-
是的,它已正确安装。这是输出:
C:\>ruby -e "require 'ruport'; puts Ruport::VERSION" 1.7.1