title: how to call a method declared inside the class_methods do of a module in ruby?
body: <p>fileA.rb</p>
  
  <pre><code>module A 
      def self.extended(base)
      base.extend(ActiveSupport::Concern)
    end
  end
  </code></pre>
  
  <p>fileB.rb</p>
  
  <pre><code>module B extend A
   included do ...
    ...
   end
   class_methods do 
    ...
     def function1(&amp;block)
      ...
      ...
     end
  
     def function2(a: nil,b: nil)
       function1 do |some_name|
       ... 
       //do some thing by the combination of all//
       ...
     end
   end
   def function3
     self.class.function2(a: x, b: y) // This call is not doing any execution   
              // of the code snippets inside the function 2 above
   end
  </code></pre>
  
  <p>How can I call the function 2, which is present inside the class_methods do of the module B by the function3 which is called from another class that inherited the module B.</p>
  
  <p>I tried as above and it failed in the next line of my code, it was like the function2 just got skipped, none of the stuffs inside the function 2 got executed, really weird. Am I missing something kindly give some help over here please.</p>
  
  <p>I am in another class.</p>
  
  <p>fileD.rb
      class D &lt;&lt; class YY
        include B
         function3  // Calling the method function3 here
         /// The above call is reaching the expected place
      end</p>