Last active
March 6, 2019 01:27
-
-
Save iamvery/d133c9b6d93899d63348e429e14af7a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ServiceOne | |
def helper_one | |
puts "one" | |
end | |
end | |
module ServiceTwo | |
def helper_two | |
puts "two" | |
end | |
end | |
module Helpers | |
include ServiceOne | |
include ServiceTwo | |
end | |
class Test | |
include Helpers | |
def run | |
helper_one | |
helper_two | |
end | |
end | |
Test.new.run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ServiceOne | |
def helper_one | |
puts "one" | |
end | |
module_function :helper_one | |
end | |
module ServiceTwo | |
def helper_two | |
puts "two" | |
end | |
module_function :helper_two | |
end | |
class TestOne | |
def run | |
ServiceOne.helper_one | |
ServiceTwo.helper_two | |
end | |
end | |
class TestTwo | |
include ServiceOne | |
include ServiceTwo | |
def run | |
helper_one | |
helper_two | |
end | |
end | |
TestOne.new.run | |
TestTwo.new.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment