Skip to content

Instantly share code, notes, and snippets.

@jtcrank
Created July 6, 2018 20:18
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 jtcrank/6435843efb2aaaf45acfb4f42afc6433 to your computer and use it in GitHub Desktop.
Save jtcrank/6435843efb2aaaf45acfb4f42afc6433 to your computer and use it in GitHub Desktop.
## This is just a quick example. It may seem odd but its the general gist of what im trying to do
## Main method
def aggregate_data(user_id:)
user = User.where(id: user_id)
posts = Concurrent::Future.execute { PostService.new.get_user_posts(user_id: user_id) }
comments = Concurrent::Future.execute { CommentService.new.get_user_comments(user_id: user_id) }
ReportingService.new.process_and_format_data(user: user, posts: posts.value, comments: comments.value)
end
class PostService
end
class CommentService
end
class ReportingService
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment