Last active
December 18, 2015 21:49
-
-
Save richmolj/5850271 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
# BgovService is just a placeholder here, to illustrate this is a service-backed | |
# class, not ActiveRecord | |
class Comment < BgovService | |
end | |
class Photo < BgovService | |
end | |
class Article | |
attr_accessor :name | |
def initialize(comment_repository, photo_repository) | |
@comment_repository, @post_repository = comment_repository, post_repository | |
end | |
def assemble | |
{ | |
:name => @name, | |
:comments => @comment_repository.all, | |
:photos => @photo_repository.all | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment