Stock = Struct.new( "Stock", :amount, :max, :beats, :deliverybeat, :version ) class BAREXTPlugin < Plugin def initialize() super if @registry.has_key?(:stock) @stock = @registry[:stock] else @stock = Hash.new end end def handle_add( m, params ) name = params[:name].downcase amount = params[:amount] beats = params[:beats] version = "1" beats = beats.to_f / amount.to_f beats *= 100 stock = Stock.new( amount, amount, beats, nil, version ) @stock[name] = stock m.reply( "done" ) end end