Can't I call a private method from a self.method

Hi
   I have in MailSending class
def self.send_mail_to_all_contacts(problem)
  description=split_name_and_email_array(joined_array,problem)
end

private
  def split_name_and_email_array(name_email_array,pb)
  code......
  split_value="somevaluehere"
end

   But here I get error as
undefined method `split_name_and_email_array' for MailSending:Class
    So Can't I call a private method from a class method

Thanks in advance
Sijo

Hi
I have in MailSending class
def self.send_mail_to_all_contacts(problem)
description=split_name_and_email_array(joined_array,problem)
end

private
def split_name_and_email_array(name_email_array,pb)
code......
split_value="somevaluehere"
end

But here I get error as
undefined method `split_name_and_email_array' for MailSending:Class
So Can't I call a private method from a class method

You can't but that isn't the problem here. You can't call an instance
method without an instance of the class (which you don't have).

Fred

Hi
   Thanks for the reply..I can call the first like
MailSendingProblem.send_mail_to_all_contacts(@problem) upto that it is
Ok But it does not call the private method So need I to make the above
private method public or any other solution?

Sijo

Like I said you can't call an instance method without an instance. It's like trying to say ActiveRecord::Base.reload - it doesn't make any sense - you can only call that on an instance.

Fred

You need to declare your "split_name_and_email_array" method as a class method:

def self.split_name_and_email_array(name_email_array,pb)
  # ...
end

Christian