I'm having trouble figuring out how to call a method from a parent module in a class.
I want to call module functions from parent module in my nested classes, but can't seem to find a way how to do this.
example:
module Awesome
  class Checker
    def awesome?
      awesome_detection
    end
  end
  module_function
  def awesome_detection
    true
  end
end
If I call Awesome::Checker.new.awesome?, it's unaware of awesome_detection
Any ideas on what I'm missing?
#!/usr/bin/env ruby -wKU
module Awesome
  class Checker
    def awesome?
      Awesome.awesome_detection
    end
  end
  def self.awesome_detection
    puts "yes"
  end
end
Awesome::Checker.new.awesome?
# => yes
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With