Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Likewise42/31a661481dff3c86ebc4 to your computer and use it in GitHub Desktop.

Select an option

Save Likewise42/31a661481dff3c86ebc4 to your computer and use it in GitHub Desktop.
# In app/helpers/users_helper.rb
require_relative 'users_helper/greet'
module UsersHelper
module Internals
end
private_constant :Internals
include Internals
def greet(user)
UserGreeting.new(self).greet(user)
end
# ...
end
# In app/helpers/users_helper.greet.rb
module UsersHelper
module Internals
class UserGreeting
def initialize(helper_module)
@h = helper_module
end
def greet(user)
"Hello, #{user.name}!"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment