r/learnruby • • Aug 24 '15

question from rubymonk - modules def self.parse

Hi there,

I am learning ruby and just want to get the meaning of the following code. I think got almost all of the code without this row:

def self.parse

here I have a method followed with its name which is 'self' but what is the meaning of the '.parse' ? For if I remove it from the class it gives me an error. I don't know also the sense of self. Please help me to uderstand it.

here is the all code of the example:

module RubyMonk
  module Parser
    class TextParser
      def self.parse(str)
       str.upcase.split("")
      end
    end
  end
 end
3 Upvotes

2 comments sorted by

View all comments

Show parent comment

0

u/boris_a Aug 26 '15 edited Sep 10 '15

thanks for the answer, I think now I see more clear. I know the meaning of the .new but here my confusing comes from my ignorance of the self.