Reopening a class defined in the gems

module Jabber
  module PubSub
    #
    class ServiceHelper
      def get_subscriptions_from_new(node)
        iq = basic_pubsub_query(:get, true)
        entities = iq.pubsub.add(REXML::Element.new('subscriptions'))
        entities.attributes['node'] = node
        res = nil
        @stream.send_with_id(iq) do |reply|
          if reply.pubsub.first_element('subscriptions')
            res = []
            if reply.pubsub.first_element('subscriptions').attributes['node'] == node
              reply.pubsub.first_element('subscriptions').each_element('subscription') do |subscription|
                res << PubSub::Subscription.import(subscription)
              end
            end
          end
        true
        end
        res
      end
    end
  end
end


service = 'pubsub.idlecampus.com'
@client = Jabber::Client.new("a@idlecampus.com")
Jabber::PubSub::ServiceHelper.new(@client, service)

doesnt seem to work.

ArgumentError: wrong number of arguments (2 for 0)
	from (irb):8:in `initialize'
	from (irb):8:in `new'

Below is how the class is defined in the library.
I am trying to add a new method get_subscriptions_from_new method in the class ServiceHelper.

module Jabber
   module PubSub
     class ServiceHelper
         def initialize(stream, pubsubjid)
           @stream = stream
           @pubsubjid = pubsubjid
           @event_cbs = CallbackList.new
           @stream.add_message_callback(200,self) { |message|
               handle_message(message)
                     }
                   end
      end
 end

I have ignored rest of the class here.

I could tell you the answer to this, but I’d rather teach you how to solve it.

What do you think the error that you’re getting means?

The error means that the constructor requires no arguments but get two. But the class that I am opening has a constructor which takes 2 arguments.