DEV Community

pooyaalamdari
pooyaalamdari

Posted on

create module

create module

module MyFirstModule
    def say_hello
        puts "Hello"
    end
end
Enter fullscreen mode Exit fullscreen mode

using created module

module MyFirstModule
    def say_hello
        puts "Hello"
    end
end

class ModuleTester
    include MyFirstModule
end

mt = ModuleTester.new 
mt.say_hello
Enter fullscreen mode Exit fullscreen mode

Top comments (0)