Help with Ruport

Im very new to Ruby, and I am trying to reduce input from a ruport
report that I have generated. When I use the standard code to generate
the report, it works fine. But after trying to remove some of the
information on the report, I am running into errors. Here is a snippet
of the code:

[code]

require 'rubygems'
require 'ruport'

data = `df -h`.split "\n"
header=data.shift.split " ", 6
data = data.map{|line| line.split(/ +/)}
report = Ruport::Data::Table.new :data => data, :column_names => header
table = table.sub_table{("Filesystem , Size, Used")}
puts report

[/code]

If I remove the "table = table.sub_table{("Filesystem, Size, Used")}"
line it works great, but those three elements are the only portions I
want the report to generate.

Any help would be appreciated.

-E

···

--
Posted via http://www.ruby-forum.com/.

http://www.catb.org/~esr/faqs/smart-questions.html

···

On Fri, Jun 15, 2012 at 7:06 AM, Erik D. <lists@ruby-forum.com> wrote:

... I am running into errors.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

I am running into errors = I am getting "undefined method 'sub_table'
for nil:NilClass(NoMethodError)"

The reason this is confusing is because without that line, the code
works perfectly. I am still learning Ruby, so I am not sure if this
requires me to entirely rethink and recode what I am trying to
accomplish, or if there is something simple that I am missing. I got
that line of code from the ruport documentation, and implemented it the
way the documentation states. (at least to my understanding)

My apologies on the vague question before.

···

--
Posted via http://www.ruby-forum.com/.

...> [code]

require 'rubygems'
require 'ruport'

data = `df -h`.split "\n"
header=data.shift.split " ", 6
data = data.map{|line| line.split(/ +/)}
report = Ruport::Data::Table.new :data => data, :column_names => header
table = table.sub_table{("Filesystem , Size, Used")}

should this ^ be report? There is no table defined other than on this line

···

On Fri, Jun 15, 2012 at 10:06 AM, Erik D. <lists@ruby-forum.com> wrote:

puts report

[/code]