Skip to content

Instantly share code, notes, and snippets.

@iamvery
Last active March 6, 2019 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamvery/d133c9b6d93899d63348e429e14af7a7 to your computer and use it in GitHub Desktop.
Save iamvery/d133c9b6d93899d63348e429e14af7a7 to your computer and use it in GitHub Desktop.
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
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