#!/usr/bin/env ruby
class RAIDController
@aCtrl = Hash.new
def initialize()
self.detect_controllers()
end
def detect_controllers()
if `dmesg |grep 3w-9xxx |wc -l`.to_i > 1
puts "Found a 3ware 9xxx controller!"
@aCtrl.store("3ware 9xxx", true)
end
end
end
ctrl = RAIDController.new()
./test.rb
Found a 3ware 9xxx controller!
./test.rb:14:in `detect_controllers': undefined method `store' for nil:NilClass (NoMethodError)
from ./test.rb:8:in `initialize'
from ./test.rb:19:in `new'
from ./test.rb:19